package com.ss.android.article.base.feature.feed.activity;

import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.os.Message;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.view.ViewTreeObserver;
import android.widget.AbsListView;
import android.widget.AdapterView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;

import com.bytedance.article.common.a.MonitorFPS;
import com.bytedance.article.common.c.JSONObjectWrapper;
import com.bytedance.article.common.c.TTUtils;
import com.bytedance.common.databinding.DataBinding;
import com.bytedance.common.databinding.ObservableArrayList;
import com.bytedance.common.databinding.q;
import com.bytedance.common.utility.Logger;
import com.bytedance.common.utility.NetworkType;
import com.bytedance.common.utility.UIUtils;
import com.bytedance.common.utility.c.SharedPreferenceCompat;
import com.bytedance.frameworks.b.a.ComponentsManifest;
import com.bytedance.frameworks.baselib.network.http.util.TaskInfo;
import com.handmark.pulltorefresh.library.OverscrollHelper;
import com.handmark.pulltorefresh.library.PullToRefreshBase;
import com.handmark.pulltorefresh.library.PullToRefreshBase.State;
import com.ss.android.account.Spipe;
import com.ss.android.action.ArticleActionHelper;
import com.ss.android.action.b.ImpressionHelper;
import com.ss.android.action.b.ImpressionRecorder;
import com.ss.android.article.base.app.AppData;
import com.ss.android.article.base.feature.app.PushPermissionDlg;
import com.ss.android.article.base.feature.app.c.ImageManager;
import com.ss.android.article.base.feature.c.FeedAdapter;
import com.ss.android.article.base.feature.c.FeedPresenter;
import com.ss.android.article.base.feature.category.a.CategoryManager;
import com.ss.android.article.base.feature.detail.presenter.DetailHelper;
import com.ss.android.article.base.feature.detail2.DetailIntentCreator;
import com.ss.android.article.base.feature.e.ArticleShareHelper;
import com.ss.android.article.base.feature.feed.FeedCellStyleConfig;
import com.ss.android.article.base.feature.feed.FeedTab;
import com.ss.android.article.base.feature.feed.a.CategoryInfo;
import com.ss.android.article.base.feature.feed.a.FeedDataProvider;
import com.ss.android.article.base.feature.feed.a.FeedDataProvider.c;
import com.ss.android.article.base.feature.feed.a.FeedRefreshFromInfo;
import com.ss.android.article.base.feature.feed.bb;
import com.ss.android.article.base.feature.feed.j;
import com.ss.android.article.base.feature.feed.presenter.ArticleQueryObj;
import com.ss.android.article.base.feature.feed.presenter.ArticleQueryObj.CtrlFlag;
import com.ss.android.article.base.feature.feed.presenter.ArticleQueryThread;
import com.ss.android.article.base.feature.feed.presenter.LastReadDataManager;
import com.ss.android.article.base.feature.feed.presenter.ListData;
import com.ss.android.article.base.feature.feed.presenter.RefreshAdManager;
import com.ss.android.article.base.feature.feed.presenter.m;
import com.ss.android.article.base.feature.feed.vh.ArticleFeedViewHolder;
import com.ss.android.article.base.feature.main.IFeedManager;
import com.ss.android.article.base.feature.main.IRecentFragment;
import com.ss.android.article.base.feature.model.Article;
import com.ss.android.article.base.feature.model.CellRef;
import com.ss.android.article.base.feature.video.IVideoController;
import com.ss.android.article.base.feature.video.IVideoControllerContext;
import com.ss.android.article.base.ui.SingleLineLinerLayout;
import com.ss.android.article.base.ui.ai;
import com.ss.android.article.base.utils.ArticleHelper;
import com.ss.android.article.base.utils.SettingsActivityHelper;
import com.ss.android.article.base.utils.searchtext.SearchHintCallback;
import com.ss.android.article.base.utils.searchtext.SearchTextHelper;
import com.ss.android.article.browser.R;
import com.ss.android.article.common.e.SubEntrance;
import com.ss.android.article.common.e.VideoControllerSupplierProxy;
import com.ss.android.article.common.view.IAssociatedScrollDownLayout;
import com.ss.android.common.app.AbsApplication;
import com.ss.android.common.app.permission.PermissionsManager;
import com.ss.android.common.app.permission.PermissionsResultAction;
import com.ss.android.common.callback.CallbackCenter;
import com.ss.android.common.callback.SSCallback;
import com.ss.android.common.lib.MobClickCombiner;
import com.ss.android.common.location.LocationHelper;
import com.ss.android.common.util.NetworkUtils;
import com.ss.android.common.view.ScrollDownLayout;
import com.ss.android.image.AvatarLoader;
import com.ss.android.messagebus.SubscriptionRouter;
import com.ss.android.model.BaseArticle;
import com.ss.android.model.ItemType;
import com.ss.android.newmedia.BaseAppData;
import com.ss.android.newmedia.BaseApplication;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

/**
 *
 */
public class ArticleRecentFragment extends ArticleListFragment implements
        c,
        bb,
        IRecentFragment,
        IAssociatedScrollDownLayout,
        SSCallback {
    @SuppressWarnings("deprecation")
    final class l$a implements ViewTreeObserver.OnGlobalLayoutListener {
        private WeakReference<ArticleRecentFragment> a;

        l$a(ArticleRecentFragment arg2) {
            this.a = new WeakReference(arg2);
        }

        public final void onGlobalLayout() {
            int v1_1;
            ArticleRecentFragment fragment = this.a.get();
            if (fragment != null) {
                if (fragment.getView() != null) {
                    if (Build.VERSION.SDK_INT >= 16) {
                        fragment.getView().getViewTreeObserver().removeOnGlobalLayoutListener(this);
                    } else {
                        fragment.getView().getViewTreeObserver().removeGlobalOnLayoutListener(this);
                    }
                }

                if (!fragment.isViewValid()) {
                    return;
                }

                if (!fragment.mFeedDataProvider.mCellRefList.isEmpty()) {
                    com.ss.android.l.c.c();
                    fragment.refreshList();
                    com.ss.android.l.c.c();
                }

                FeedDataProvider v1 = fragment.mFeedDataProvider;
                if (v1.p) {
                    v1.p = false;
                    v1_1 = 1;
                } else {
                    v1_1 = 0;
                }

                if (v1_1 == 0) {
                    return;
                }

                if (fragment.isLoading()) {
                    return;
                }

                if (!fragment.mNetworkMonitor.isNetworkOn()) {
                    return;
                }

                fragment.mRefreshFrom = 0;
                fragment.mIsPullingToRefresh = true;
                fragment.queryData();
            }
        }
    }

    public static final String BUNDLE_ENTER_TYPE = "enter_type";
    public static final int FEED_FLAG_PANEL_WEATHER_ENTRY = 1;
    private static final String LAST_LOCATION_PERMISSION_REQUEST_TIME = "last_location_permission_request_time";
    private static final int LAST_READ_MIN_COUNT = 5;
    private static final int LAST_READ_TOO_EARLY_MIN_COUNT = 60;
    private static final int LOAD_MORE_FROM_AUTO = 0;
    private static final int LOAD_MORE_FROM_CLICK = 1;
    protected static final int NOTIFY_ACTION_CATE_TIP = 100;
    protected static final String PULL_REFRESH = "pull_refresh";
    protected static final String PULL_REFRESH_CANCEL_COUNT = "pull_refresh_cancel_count";
    protected static final String PULL_REFRESH_COUNT = "pull_refresh_count";
    static final String TAG = "ArticleRecentFragment";
    private com.b.a.a.a bridgeApi;
    protected String extra;
    private long mActiveStayDuration;
    private ai mAdHeader;
    private String mApiParam;
    private AvatarLoader mAuthorVideoAvatarLoader;
    CategoryManager mCateMgr;
    protected int mCategoryArticleType;
    protected String mCategoryCity;
    private String mCategoryId;
    protected String mCategoryName;
    protected String mCity;
    protected String mConcernDetailVideoQueryDict;
    private DataBinding mDataBinding;
    private View mDevider;
    private List mDraftsList;
    private Map mEnterEventContext;
    public FeedDataProvider mFeedDataProvider;
    private boolean mFirstResume;
    private boolean mForce;
    private boolean mHasTips;
    protected boolean mHaveAddSubChannel;
    private ImageManager mImageManager;
    private boolean mInitialized;
    private boolean mIsAdShowFull;
    private boolean mIsAdShowPart;
    private boolean mIsAdShowPct;
    private boolean mIsBackRefresh;
    private boolean mIsEnterRefresh;
    protected boolean mIsFromConcernDetailVideo;
    protected boolean mIsLoadingLocal;
    private boolean mIsPullRefreshManual;
    private long mLastMaxBehotTime;
    private long mLastReadTime;
    public static boolean mLazyLoad = true;
    private int mLoadMoreFrom;
    private boolean mLocalNewsFailedSent;
    private int mMaxOffset;
    private MonitorFPS mMonitorFPS;
    private int mMorePos;
    private int mOffsetRes;
    private PullToRefreshBase.OnTouchHook mOnTouchHook;
    private boolean mOnVideoTab;
    protected boolean mPendingChoseCityResult;
    protected boolean mPendingDetailResult;
    private boolean mPendingPullRefresh;
    private String mPostContentHint;
    private WeakReference<ArticleQueryThread> mQueryRef;
    int mRefreshFrom;
    String mRefreshFromString;
    private long mResumeTime;
    private Integer mScreenHeight;
    protected String mScreenName;
    protected SingleLineLinerLayout mSearchLayout;
    private boolean mShowDislikeTip;
    private int mShowEtStatus;
    protected List mSubchannelLayoutList;
    private TaskInfo mTaskInfo;
    private long mUserId;
    int mWendaReferType;

    public ArticleRecentFragment() {
        this.mPendingDetailResult = false;
        this.mPendingChoseCityResult = false;
        this.mLocalNewsFailedSent = false;
        this.mSubchannelLayoutList = new ArrayList();
        this.mMorePos = -1;
        this.mQueryRef = null;
        this.mFirstResume = true;
        this.mShowDislikeTip = false;
        this.mRefreshFrom = -1;
        this.mLoadMoreFrom = 0;
        this.mOffsetRes = 0;
        this.mWendaReferType = -1;
        this.mUserId = -1;
        this.mIsPullRefreshManual = false;
        this.mFeedDataProvider = null;
        this.mForce = false;
        this.mIsAdShowPct = true;
        this.mEnterEventContext = new HashMap();
        this.mDraftsList = null;
        this.mIsEnterRefresh = false;
        this.mIsLoadingLocal = true;
        this.mInitialized = false;
        this.mPendingPullRefresh = false;
    }

    public void addListHeader() {
    }

    private void addSubEntrance() {
        this.extractSubEntrance();
        this.updateSubEntrance();
    }

    public void afterFeedShowOnResumed() {
        this.ensureInitialized();
        ArticleRecentFragment.mLazyLoad = false;
    }

    public void associateScrollDownLayout() {
        if (this.mPullRefreshList != null && this.mListView != null) {
            ViewParent v0 = this.mPullRefreshList.getParent();
            while (v0 != null) {
                if ((v0 instanceof ScrollDownLayout)) {
                    ListView v2 = this.mListView;
                    if (((ScrollDownLayout) v0).mAssociatedView != null && ((((ScrollDownLayout) v0).mAssociatedView instanceof ListView))) {
                        ((ListView) ((ScrollDownLayout) v0).mAssociatedView).setOnScrollListener(null);
                    }

                    ((AbsListView) v2).setOnScrollListener(((ScrollDownLayout) v0).mAssociatedListViewListener);
                    ((ScrollDownLayout) v0).updateListViewScrollState(v2);
                    ((ScrollDownLayout) v0).mAssociatedView = v2;
                    ((ScrollDownLayout) v0).updateAssociatedViewPadding();
                } else {
                    v0 = v0.getParent();
                    continue;
                }

                return;
            }
        }
    }

    private void beginDataBinding() {
        com.ss.android.l.c.c();
        this.mDataBinding = DataBinding.a(this.getView());
        DataBinding v1 = this.mDataBinding;
        synchronized (v1) {
            if (v1.i) {
                throw new IllegalStateException("Binding is already started, do you forgot commit binding last time?");
            }
        }
        v1.a();
        v1.i = true;
        this.mDataBinding.a(new q() {

            public final void a() {
                if (isViewValid()) {
                    updateLoadingStatus();
                    if (isLoading()) {
                        hideNoDataView();
                        hideNoNetView();
                    } else {
                        mPullRefreshList.onRefreshComplete();
                        if ((getData().isEmpty()) && !mNetworkMonitor.isNetworkOn()) {
                            showNoNetView();
                        }
                    }
                }
            }
        }, new com.bytedance.common.databinding.e[]{this.mFeedDataProvider.d});
        this.mDataBinding.a(new q() {

            public final void a() {
                if ((isViewValid()) && (isLoading())) {
                    if (!((Boolean) mFeedDataProvider.isRefresh.get()).booleanValue() && !getData().isEmpty()) {
                        mFooter.switchToLoading();
                        if (AppData.getInstance().getAbSettings().isFeedLoadMoreNewData()) {
                            mFooter.setLoadingText(com.ss.android.article.browser.R.string.loading_pgc_article_label);
                        } else {
                            mFooter.setLoadingText(com.ss.android.article.browser.R.string.loading_article_label);
                        }
                        return;
                    }
                    mFooter.hideFooterContent();
                }
            }
        }, new com.bytedance.common.databinding.e[]{this.mFeedDataProvider.d, this.mFeedDataProvider.isRefresh});
        this.mDataBinding.a(new q() {
            private int a;

            public final void a() {
                if ((isViewValid()) && !isLoading() && !mFeedDataProvider.mCellRefList.isEmpty()) {
                    if (!getListData().c && !getListData().d) {
                        if (mFooter == null) {
                        } else if (mWendaReferType == -1) {
                        } else if (mNetworkMonitor.isNetworkOn()) {
                            mFooter.switchToNoMoreContent(com.ss.android.article.browser.R.string.no_more_content);
                        } else {
                        }
                    } else if (mFooter == null) {
                    } else if (mAdapter.getCount() <= 0) {
                    } else if (this.a == 0) {
                    } else {
                        mFooter.switchToMoreContent();
                    }
                }

                if (mAdapter != null) {
                    this.a = mAdapter.getCount();
                }
            }
        }, new com.bytedance.common.databinding.e[]{this.mFeedDataProvider.h});
        this.mDataBinding.a(new com.bytedance.common.databinding.q() {
            public final void a() {
                if ((isViewValid()) && mAdapter != null) {
                    mAdapter.a(((Long) mFeedDataProvider.c.get()).longValue());
                }
            }
        }, new com.bytedance.common.databinding.e[]{this.mFeedDataProvider.c});
        this.mDataBinding.a(new com.bytedance.common.databinding.q() {
            public final void a() {
                if (isViewValid()) {
                    updateSubEntrance();
                }
            }
        }, new com.bytedance.common.databinding.l[]{this.mFeedDataProvider.f});
        this.mDataBinding.a(new com.bytedance.common.databinding.q() {

            public final void a() {
                if ((isViewValid()) && mFeedDataProvider.i.get() != null) {
                    int v0 = mFeedDataProvider.r ? 1 : 0;
                    if (v0 != 0) {
                        return;
                    }

                    if (((FeedDataProvider.d$b) mFeedDataProvider.i.get()).a == null) {
                        if (((FeedDataProvider.d$b) mFeedDataProvider.i.get()).b != null) {
                            showNotify(((FeedDataProvider.d$b) mFeedDataProvider.i.get()).b);
                        } else {
                            showNotify(((FeedDataProvider.d$b) mFeedDataProvider.i.get()).a, ((FeedDataProvider.d$b) mFeedDataProvider.i.get()).c);
                        }
                    }

                    mFeedDataProvider.i.set(null);
                }
            }
        }, new com.bytedance.common.databinding.e[]{this.mFeedDataProvider.i});
        v1 = this.mDataBinding;
        synchronized (v1) {
            v1.i = false;
            v1.c = true;
        }
        v1.a.run();
        this.getView().getViewTreeObserver().addOnGlobalLayoutListener(new l$a(this));
    }

    void checkCategoryTip() {
        this.checkCategoryTip(true);
    }

    void checkCategoryTip(boolean arg2) {
        this.checkCategoryTip(arg2, false);
    }

    void checkCategoryTip(boolean arg11, boolean arg12) {
        String v0_2;
        FragmentActivity v1 = null;
        int v6 = 86400;
        int v2 = 100;
        boolean v5 = true;
        Logger.v("ArticleRecentFragment", "checkCategoryTip " + this.mCategoryCity + " " + arg11);
        FragmentActivity v0 = this.getActivity();
        FragmentActivity v7 = (v0 instanceof IFeedManager) ? v0 : v1;
        boolean v3 = v7 == null || !((IFeedManager) v7).getUseTabTip() ? false : true;
        int v0_1 = v7 == null || (((IFeedManager) v7).isViewCategory()) ? 1 : 0;
        if (v3) {
            v0_1 = this.getData() == null || (this.getData().isEmpty()) ? 1 : 0;
            if (v0_1 != 0 || (this.mPendingPullRefresh)) {
                label_42:
                v0_2 = ((String) null);
            } else {
                if ((this.isLoading()) && !this.isLoadingLocal()) {
                    v0_2 = ((String) null);
                } else {
                    v0_2 = this.mAppData.a(this.mCategoryCity, v3, arg11, arg12);
                }
            }

            ((IFeedManager) v7).updateCategoryTip(v0_2);
            if (android.support.design.a.isTextEmpty(v0_2)) {
                v5 = false;
            }

            this.setHasTips(v5);
        } else {
            if (this.getData() == null) {
                return;
            }

            if (this.getData().isEmpty()) {
                return;
            }

            if (this.mNotifyView == null) {
                return;
            }

            if (this.mNotifyViewText == null) {
                return;
            }

            if (!v3 && v0_1 == 0) {
                return;
            }

            String v3_1 = this.mAppData.a(this.mCategoryCity, v3, arg11, arg12);
            if (android.support.design.a.isTextEmpty(v3_1)) {
                return;
            }

            Object v0_3 = this.mNotifyView.getTag();
            int v1_1 = -1;
            v0_1 = (v0_3 instanceof Integer) ? ((Integer) v0_3).intValue() : v1_1;
            if (v0_1 == v2 && (v3_1.equals(this.mNotifyViewText.getText()))) {
                return;
            }

            v0_1 = this.mAppData.mCategoryTipDuration;
            if (v0_1 <= 0) {
                v0_1 = 15;
            } else if (v0_1 > v6) {
                v0_1 = v6;
            }

            long v6_1 = 1000 * (((long) v0_1));
            this.mAppData.b(this.mCategoryCity, System.currentTimeMillis() + v6_1);
            this.doShowNotify(v2, v3_1, 0, true, v6_1, true, 0);
        }
    }

    private boolean checkCityChange() {
        return false;
    }

    public void checkDayNightTheme() {
        if (this.isViewValid()) {
            this.tryRefreshTheme();
            if (this.mAdapter != null) {
                this.setItemViewReuseTag();
                this.mAdapter.notifyDataSetChanged();
            }
        }
    }

    boolean checkLoginStatus() {
        boolean v0 = true;
        if (Spipe.inst().isLogin) {
            if (this.mUserId != Spipe.inst().userId) {
                this.mUserId = Spipe.inst().userId;
            } else {
                return false;
            }
        } else if (this.mUserId > 0) {
            this.mUserId = -1;
        } else {
            v0 = false;
        }

        return v0;
    }

    public void checkPlayVideo(boolean arg11) {
        int v0_2;
        if (this.mListView != null && this.mContext != null && this.mAdapter != null && ("__all__".equals(this.mCategoryName)) && (this.mAppData.videoAutoPlay()) && this.mAppData.videoAutoPlayModeLocalSp != 2) {
            int v6 = this.mListView.getFirstVisiblePosition();
            int v7 = this.mListView.getLastVisiblePosition();
            int v2 = 0;
            int v5;
            for (v5 = v6; v5 <= v7; ++v5) {
                if (v5 >= this.mAdapter.getCount()) {
                    break;
                }

                View v1 = this.mListView.getChildAt(v5 - v6);
                if (v1 != null) {
                    Object v0 = v1.getTag();
                    if ((v0 instanceof j)) {
                        CellRef v3 = ((j) v0).a();
                        if (v3 == null || !v3.l() || !v3.g() || v3.videoStyle != 2) {
                            v0_2 = v2;
                        } else {
                            int[] v2_1 = new int[2];
                            View v0_1 = ((j) v0).b();
                            if (v0_1 == null) {
                                v0_1 = v1;
                            }

                            v0_1.getLocationOnScreen(v2_1);
                            if (this.mScreenHeight == null) {
                                this.mScreenHeight = Integer.valueOf(this.mContext.getResources().getDisplayMetrics().heightPixels);
                            }

                            float v1_1 = UIUtils.dp2px(this.mContext, 47f);
                            if (!arg11) {
                                if ((((float) (-v2_1[1]))) + v1_1 + (((float) UIUtils.getStatusBarHeight(this.mContext))) <= (((float) (v0_1.getHeight() / 2)))) {
                                    this.mScreenHeight.intValue();
                                    v0_1.getHeight();
                                }

                                if ((((float) v2_1[1])) > v1_1 + (((float) UIUtils.getStatusBarHeight(this.mContext)))) {
                                    this.mScreenHeight.intValue();
                                    v0_1.getHeight();
                                }

                                v2 = 1;
                                continue;
                            }

                            if ((((float) (-v2_1[1]))) + v1_1 + (((float) UIUtils.getStatusBarHeight(this.mContext))) <= (((float) (v0_1.getHeight() / 2)))) {
                                this.mScreenHeight.intValue();
                                v0_1.getHeight();
                            }

                            if ((((float) v2_1[1])) > v1_1 + (((float) UIUtils.getStatusBarHeight(this.mContext)))) {
                                this.mScreenHeight.intValue();
                                v0_1.getHeight();
                            }

                            v0_2 = 1;
                        }

                        v2 = v0_2;
                    } else {
                        if (!(v0 instanceof com.ss.android.article.base.feature.feed.cc)) {
                            continue;
                        }

                        CellRef v4 = ((com.ss.android.article.base.feature.feed.cc) v0).b();
                        if (v4 == null) {
                            continue;
                        }

                        if (!v4.g()) {
                            continue;
                        }

                        int v3_1 = !v4.l() || v4.videoStyle != 2 ? 0 : 1;
                        int v4_1 = !v4.k() ? 1 : 0;
                        if (v3_1 == 0 && v4_1 == 0) {
                            continue;
                        }

                        int[] v4_2 = new int[2];
                        View v2_2 = ((com.ss.android.article.base.feature.feed.cc) v0).m_();
                        if (v2_2 != null) {
                            v1 = v2_2;
                        }

                        v1.getLocationOnScreen(v4_2);
                        if (this.mScreenHeight == null) {
                            this.mScreenHeight = Integer.valueOf(this.mContext.getResources().getDisplayMetrics().heightPixels);
                        }

                        float v2_3 = UIUtils.dp2px(this.mContext, 47f);
                        if (!arg11) {
                            if ((((float) (-v4_2[1]))) + v2_3 + (((float) UIUtils.getStatusBarHeight(this.mContext))) > (((float) v1.getHeight())) || (((float) (this.mScreenHeight.intValue() - v4_2[1]))) < 0f) {
                                ((com.ss.android.article.base.feature.feed.cc) v0).a(true);
                            }

                            if ((((float) v4_2[1])) > v2_3 + (((float) UIUtils.getStatusBarHeight(this.mContext))) && (((float) (this.mScreenHeight.intValue() - v4_2[1]))) > (((float) v1.getHeight())) && v3_1 != 0) {
                                ((com.ss.android.article.base.feature.feed.cc) v0).a(false);
                            }

                            v2 = 1;
                            continue;
                        }

                        if ((((float) (-v4_2[1]))) + v2_3 + (((float) UIUtils.getStatusBarHeight(this.mContext))) > (((float) v1.getHeight())) || (((float) (this.mScreenHeight.intValue() - v4_2[1]))) < 0f) {
                            ((com.ss.android.article.base.feature.feed.cc) v0).a(true);
                        }

                        if ((((float) v4_2[1])) > v2_3 + (((float) UIUtils.getStatusBarHeight(this.mContext))) && (((float) (this.mScreenHeight.intValue() - v4_2[1]))) > (((float) v1.getHeight())) && v3_1 != 0) {
                            ((com.ss.android.article.base.feature.feed.cc) v0).a(false);
                        }

                        v2 = 1;
                    }
                }
            }

            if (v2 != 0) {
                return;
            }

            if (this.getVideoController() == null) {
                return;
            }

            IVideoController v0_3 = this.getVideoController();
            if (!v0_3.isVideoVisible()) {
                if (!v0_3.isPauseFromList()) {
                } else if (!v0_3.isPatchVideo()) {
                    v0_3.releaseMedia();
                }

                return;
            } else {
                v0_3.releaseMedia();
            }


        }
    }

    private void checkShowPushPermissionDlg(final Context context) {
        try {
            com.bytedance.common.utility.b.a.a(new AsyncTask() {

                protected final Object doInBackground(Object[] arg15) {
                    long v12 = 86400000;
                    Object v10 = null;
                    int v0 = R.drawable.rs;
                    boolean v1 = false;
                    try {
                        boolean v2 = mAppData.o();
                        AppData v3 = mAppData;
                        int v4 = SettingsActivityHelper.areNotificationsEnabled(v3.mContext);
                        Logger.d("push_guide", "status:" + v4);
                        Logger.d("push_guide", "count:" + v3.pushDlgShowCount + "   " + v3.pushDlgShowMax);
                        if (v4 == 0 && v3.pushDlgShowCount < v3.pushDlgShowMax) {
                            long v4_1 = System.currentTimeMillis();
                            if (v4_1 - v3.pushDlgShowLast > (((long) v3.pushDlgShowInterval)) * v12 && v4_1 - v3.perDlgShowLast > (((long) v3.perDlgShowInterval)) * v12) {
                                v1 = true;
                            }
                        }

                        Logger.d("push_guide", v2 + "   " + v1);
                        if (!v2 && !v1) {
                            return v10;
                        }

                        if (v2 && v1) {
                            showPushPermissionDlg(context, R.drawable.rs, new View.OnClickListener() {

                                public final void onClick(View arg3) {
                                    com.ss.android.newmedia.message.c.a().a(Boolean.valueOf(true));
                                    mAppData.n();
                                    goSetting();
                                }
                            });
                        } else {
                            if (v2) {
                                try {
                                    showPushPermissionDlg(context, R.drawable.rs, new View.OnClickListener() {

                                        public final void onClick(View arg3) {
                                            com.ss.android.newmedia.message.c.a().a(Boolean.valueOf(true));
                                            mAppData.n();
                                        }
                                    });
                                } catch (Throwable v0_1) {
                                    v0_1.printStackTrace();
                                }
                            } else {
                                if (v1) {
                                    if (mAppData.p() == 0) {
                                        v0 = R.drawable.jb;
                                    }

                                    showPushPermissionDlg(context, v0, new View.OnClickListener() {

                                        public final void onClick(View arg2) {
                                            goSetting();
                                        }
                                    });
                                }
                            }
                        }

                    } catch (Throwable v0_1) {

                    }

                    AppData v0_2 = mAppData;
                    long v2_1 = System.currentTimeMillis();
                    v0_2.pushDlgShowLast = v2_1;
                    v0_2.perDlgShowLast = v2_1;
                    SharedPreferences.Editor v1_1 = v0_2.mContext.getSharedPreferences("app_setting", 0).edit();
                    v1_1.putLong("push_dlg_show_last", v0_2.pushDlgShowLast);
                    v1_1.putLong("per_dlg_show_last", v0_2.perDlgShowLast);
                    SharedPreferenceCompat.commit(v1_1);
                    v0_2 = mAppData;
                    ++v0_2.pushDlgShowCount;
                    v1_1 = v0_2.mContext.getSharedPreferences("app_setting", 0).edit();
                    v1_1.putInt("push_dlg_show_count", v0_2.pushDlgShowCount);
                    SharedPreferenceCompat.commit(v1_1);

                    return v10;
                }
            }, new Object[0]);
        } catch (Throwable v0) {
            v0.printStackTrace();
        }
    }

    public int contextType() {
        int v0 = ("video".equals(this.mCategoryName)) || (this.mOnVideoTab) ? 1 : super.contextType();
        return v0;
    }

    private void dismissVideo() {
        IVideoController v0 = this.getVideoController();
        if (v0 != null) {
            v0.releaseMedia();
        }
    }

    public void doHandleItemClick(int arg14, CellRef cellRef, View arg16, boolean viewComments, boolean showWriteCommentDialog) {
        FragmentActivity fragmentActivity = this.getActivity();
        if (fragmentActivity != null && cellRef != null) {
            Article article = cellRef.article;
            String goDetailLabel = this.getGoDetailLabel();
            if (viewComments && article != null && article.groupId > 0) {
                long commentId = article.comment != null ? article.comment.commentId : 0;
                JSONObject jsonObject = new JSONObject();
                try {
                    jsonObject.put("item_id", article.itemId);
                    jsonObject.put("aggr_type", article.aggrType);
                } catch (JSONException jsonException) {

                }
                MobClickCombiner.onEvent(this.getActivity(), "click_list_comment", goDetailLabel, article.groupId, commentId, jsonObject);
            }

            this.onCategoryEvent("detail_click");
            this.getListData().b = arg14;
            this.getListData().a = this.getData();
            this.mAppData.a(this.getListData(), 1, this.mCategoryName);
            Intent intent = new Intent();
            intent.putExtra("list_type", 1);
            intent.putExtra("category", this.mCategoryName);
            intent.putExtra("view_comments", viewComments);
            intent.putExtra("is_jump_comment", viewComments);
            intent.putExtra("show_write_comment_dialog", showWriteCommentDialog);
            boolean isUgcStyle = (cellRef.cellFlag & 128) > 0;
            intent.putExtra("is_ugc_style", isUgcStyle);
            if (cellRef.logPb != null) {
                intent.putExtra("log_pb", cellRef.logPb.toString());
            }

            Intent v2_3;
            if (android.support.design.a.hasVideo(article)) {
                int v2_2 = 0;
                IVideoController videoController = this.getVideoController();
                if (videoController != null) {
                    if (videoController.getBindedTag() == article) {
                        long currentPlayPosition = videoController.getCurrentPlayPosition();
                        if (currentPlayPosition <= 0 && !VideoControllerSupplierProxy.getInstance().getVideoControllerInstance().isVideoPlaybackCompleted()) {
                            videoController.releaseMedia();
                        } else if ((this.getActivity() instanceof FeedTab)) {
                            intent.putExtra("video_play_position", currentPlayPosition);
                            videoController.pauseAtList();
                            if (cellRef.l() && (cellRef.g()) && cellRef.videoStyle == 2 && currentPlayPosition > 0) {
                                intent.putExtra("video_direct_play_in_feed", true);
                                v2_2 = 1;
                            }
                        } else {
                            videoController.releaseMedia();
                        }

                        if (v2_2 == 0) {

                        } else {
                            videoController.onEnterDetailEvent();
                        }
                    } else {
                        videoController.releaseMedia();
                    }
                }
                v2_3 = ComponentsManifest.findComponent(DetailIntentCreator.class).createNewVideoDetailIntent(fragmentActivity, intent.getExtras());
            } else {
                v2_3 = ComponentsManifest.findComponent(DetailIntentCreator.class).createNewDetailIntent(fragmentActivity, intent.getExtras());
            }

            this.startActivityForResult(v2_3, 110);
        }
    }

    protected void doHideNotify(int arg5) {
        if (arg5 == 100) {
            this.mAppData.b(this.mCategoryCity, System.currentTimeMillis());
        }
        super.doHideNotify(arg5);
    }

    protected void doOnActivityCreated() {
        long concernId = 0L;
        long forumMovieId = 0L;
        int v2_1;
        super.doOnActivityCreated();
        this.mInitialized = true;
        AppData v2 = this.mAppData;
        if ((v2.mHasShowDislikeReadingDlg) || v2.mTryShowDislikeReadingDlgCount < 4) {
            v2_1 = 0;
        } else {
            v2_1 = v2.showDislikeTip == 1 ? 1 : 0;
            if (v2_1 == 0) {
                v2_1 = 0;
            } else {
                v2_1 = 1;
            }
        }

        if (v2_1 != 0) {
            this.mShowDislikeTip = true;
        }

        this.mUserId = this.mSpipe.userId;
        this.mFirstResume = true;
        this.mRefreshFrom = 0;
        this.mLocalNewsFailedSent = false;
        FragmentActivity fragmentActivity = this.getActivity();
        if ((fragmentActivity instanceof IFeedManager)) {
            ((IFeedManager) fragmentActivity).addIRecentFragment(this);
        }

        this.mTaskInfo = new TaskInfo();
        this.mImageManager = new ImageManager(((Context) fragmentActivity));
        int v6 = ((Context) fragmentActivity).getResources().getDimensionPixelSize(R.dimen.video_digg_author_size);
        this.mAuthorVideoAvatarLoader = new AvatarLoader(this.mTaskInfo, this.mImageManager, v6 << 1, v6, 32, 4);
        this.mAuthorVideoAvatarLoader.mIsNightMode = AppData.isNightMode();
        this.mLastReadLocalEnable = fragmentActivity instanceof FeedTab;
        Bundle bundle = this.getArguments() == null ? this.getExtraArguments() : this.getArguments();
        if (bundle != null) {
            this.mCategoryArticleType = bundle.getInt("category_article_type");
            this.mOnVideoTab = bundle.getBoolean("on_video_tab");
            this.extra = bundle.getString("extra");
            this.mReferType = bundle.getInt("refer_type", 1);
            concernId = bundle.getLong("concern_id");
            forumMovieId = bundle.getLong("forum_movie_id", 0);
            this.mConcernDetailVideoQueryDict = bundle.getString("concern_video_query_dict");
            this.mIsFromConcernDetailVideo = bundle.getBoolean("from_concern_video", false);
            this.mWendaReferType = bundle.getInt("wenda_refer_type", -1);
            this.mApiParam = bundle.getString("api_param");
        }

        if ("video".equals(this.mCategoryName)) {
            UIUtils.setLayoutMargins(this.mNotifyView, 0, -3, 0, -3);
        }

        this.mCateMgr = CategoryManager.getInstance(fragmentActivity);
        CategoryInfo categoryInfo = new CategoryInfo(this.mCategoryName);
        categoryInfo.mCategoryCity = mCategoryName;
        categoryInfo.mReferType = this.mReferType;
        categoryInfo.mIsFromConcernDetailVideo = this.mIsFromConcernDetailVideo;
        categoryInfo.mForumMovieId = forumMovieId;
        categoryInfo.mExtra = this.extra;
        categoryInfo.mOnVideoTab = this.mOnVideoTab;
        categoryInfo.mConcernDetailVideoQueryDict = this.mConcernDetailVideoQueryDict;
        categoryInfo.mWendaReferType = this.mWendaReferType;
        categoryInfo.mApiParam = this.mApiParam;
        categoryInfo.mLastReadLocalEnable = this.mLastReadLocalEnable;
        categoryInfo.l = 1;
        com.ss.android.article.base.feature.feed.a.a v3 = com.ss.android.article.base.feature.feed.a.a.a();
        String v5 = this.mCategoryName;
        if (AppData.getInstance().getAppSettings().shouldPreloadFeed() != v3.c) {
            boolean v2_3 = !v3.c ? true : false;
            com.ss.android.article.base.feature.feed.a.a.a(v2_3);
        }

        this.mFeedDataProvider = (FeedDataProvider) v3.b.get(v5);
        if (this.mFeedDataProvider == null) {
            this.mFeedDataProvider = new FeedDataProvider();
        }

        this.mFeedDataProvider.a(categoryInfo);
        FeedDataProvider v2_4 = this.mFeedDataProvider;
        v2_4.mRefArticleRecentFragment = new WeakReference(this);
        v2_4.c();
        FeedDataProvider v3_1 = this.mFeedDataProvider;
        if (((Long) v3_1.c.get()).longValue() != concernId) {
            v3_1.c.set(Long.valueOf(concernId));
        }

        this.mArticleActionHelper = new ArticleActionHelper(this.mContext);
        this.mDetailHelper = new DetailHelper(this.getActivity(), ItemType.ARTICLE, this.mHandler, this.mArticleActionHelper, "xiangping");
        this.mArticleShareHelper = new ArticleShareHelper(this.getActivity(), this.mArticleActionHelper, this.mDetailHelper, 201);
        this.mArticleShareHelper.mCategoryName = this.mCategoryName;
        this.mAdapter = new FeedAdapter(fragmentActivity, this, this.mNetworkMonitor,
                this.mRootView, this, 1, this.mDiggAnimationView, this.mArticleActionHelper,
                this.mArticleShareHelper, this.mCategoryName, this.mReferType);
        this.mAdapter.a(concernId);
        this.setCategoryCity(mCategoryName);
        this.mAdapter.setLastReadClickListener(new View.OnClickListener() {
            public final void onClick(View arg6) {
                refreshList(-1, true);
                mRefreshFrom = 6;
                mListView.setSelection(0);
                if (mFeedDataProvider != null) {
                    mFeedDataProvider.v = System.currentTimeMillis();
                }

                mPullRefreshList.setRefreshing(true);
            }
        });
        this.beginDataBinding();
        this.registerLifeCycleMonitor(this.mAdapter);
        this.mAdapter.setListView(this.mListView);
        this.addListHeader();
        this.addSubEntrance();
        this.mListView.setAdapter(this.mAdapter);
        this.mListView.setRecyclerListener(this.mAdapter);
        this.mPullRefreshList.setOnRefreshListener(new PullToRefreshBase.OnRefreshListener2() {

            public final void onPullDownToRefresh(PullToRefreshBase toRefreshBase) {
                if (mRefreshFrom <= 0) {
                    mRefreshFrom = 7;
                    if (mAppData.getAbSettings().isAppLogOld()) {
                        if ("__all__".equals(mCategoryName)) {
                            MobClickCombiner.onEvent(getActivity(), "new_tab", "refresh_pull");
                        } else {
                            if ((mCategoryName.equals("hotsoon")) && ((getActivity() instanceof IVideoControllerContext)) && !((IVideoControllerContext) getActivity()).isStreamTab()) {
                                mCategoryName = "subv_hotsoon";
                            }
                            MobClickCombiner.onEvent(getActivity(), "category", "refresh_pull_" + mCategoryName);
                        }
                    }

                    if (!mAppData.getAbSettings().isAppLogNew()) {

                    } else {
                        onRefreshEventNew("pull");
                    }
                }

                doPullDownToRefresh();
                if (toRefreshBase != null && toRefreshBase.getState() == State.REFRESHING) {
                    FragmentActivity v0 = getActivity();
                    if ((v0 instanceof IFeedManager)) {
                        ((IFeedManager) v0).onUserPullToRefresh();
                    }
                }
            }
        });
        this.mPullRefreshList.setStatisticsListener(new com.handmark.pulltorefresh.library.PullToRefreshBase.PullToRefreshBase$g(this));
        this.mPullRefreshList.setOverScrollListener(new OverscrollHelper(this));
        this.mOnTouchHook = new PullToRefreshBase.OnTouchHook(this);
        this.mPullRefreshList.setOnTouchHook(this.mOnTouchHook);
        this.mLoadMore.setText(com.ss.android.article.browser.R.string.label_load_more_article);
        this.mPullRefreshList.getLoadingLayoutProxy().setRefreshingLabel(this.getString(com.ss.android.article.browser.R.string.loading_article_label));
        this.mPullRefreshList.getLoadingLayoutProxy().setPullLabel(this.getString(com.ss.android.article.browser.R.string.label_pull_to_refresh_pull));
        this.mPullRefreshList.getLoadingLayoutProxy().setReleaseLabel(this.getString(com.ss.android.article.browser.R.string.label_pull_to_refresh_release));
        if ((this.mPullRefreshList.getHeaderLayout() instanceof ai)) {
            this.mAdHeader = (ai) this.mPullRefreshList.getHeaderLayout();
            RefreshAdManager.o$a v2_5 = RefreshAdManager.a(fragmentActivity).a(this.mCategoryName);
            if (this.mAdHeader != null && v2_5 != null) {
                this.mAdHeader.a(v2_5, this.mCategoryName);
            }
        }

        CallbackCenter.addCallback(BaseAppData.callbackTypeCityChangeClient, this);
        if (this.isPrimaryPage()) {
            this.requestLocationPermission();
        }

        this.mFeedDataProvider.cancelPreviousQueryThread();
    }

    protected void doOnViewCreated(View view) {
        int resId = this.getExtraLayout();
        if (resId > 0) {
            LayoutInflater.from(this.getActivity()).inflate(resId, (ViewGroup) view, true);
        }

        this.mRootView = view;
        if (((this.mRootView instanceof ViewGroup)) && !(this.mRootView instanceof AdapterView)) {
            try {
                this.mDiggAnimationView = com.ss.android.article.base.ui.DiggAnimationView.a((ViewGroup) this.mRootView);
            } catch (Exception v0) {
            }
        }

        super.doOnViewCreated(view);
        FeedCellStyleConfig.adaptCellNightMode(this.mListView);
        this.mSearchLayout = this.mRootView.findViewById(com.ss.android.article.browser.R.id.ln);
        this.mSearchLayout.setCategoryName(this.mCategoryName);
        this.mDevider = this.mRootView.findViewById(com.ss.android.article.browser.R.id.lo);
        this.updateSubEntrance();
    }

    public void doPullDownToRefresh() {
        this.getSearchText();
        this.onPullRefresh();
        if (!this.mIsPullRefreshManual) {
            this.mIsPullRefreshManual = true;
        } else if ("__all__".equals(this.mCategoryName)) {
            this.checkShowPushPermissionDlg(this.mContext);
        }
    }

    protected void ensureInitialized() {
        if (!this.mInitialized && this.getContext() != null) {
            this.mInitialized = true;
            this.doOnViewCreated(this.mRootView);
            this.doOnActivityCreated();
        }
    }

    private void extractSubEntrance() {
        if (this.mFeedDataProvider != null) {
            try {
                String v2 = "app_setting";
                String v0_2;
                synchronized (v2) {
                    v0_2 = this.getActivity().getSharedPreferences("app_setting", 0)
                            .getString(this.mCategoryName + "sub_channel", null);
                }
                label_20:
                if (android.support.design.a.isTextEmpty(v0_2)) {
                    return;
                }

                JSONArray v3 = new JSONArray(v0_2);
                this.mFeedDataProvider.f.clear();
                int v2_1 = 0;
                while (true) {
                    label_28:
                    if (v2_1 >= v3.length()) {
                        return;
                    }

                    JSONObject v0_3 = v3.getJSONObject(v2_1);
                    if (v0_3 != null) {
                        SubEntrance v4 = new SubEntrance();
                        v4.initWithJO(v0_3);
                        int v0_4;
                        if (android.support.design.a.isTextEmpty(v4.name)) {
                            break;
                        } else if (!android.support.design.a.isTextEmpty(v4.openUrl)) {
                            v0_4 = 1;
                        } else {
                            v0_4 = 0;

                        }

                        if (v0_4 != 0) {
                            this.mFeedDataProvider.f.add(v4);
                        }
                    }

                    ++v2_1;
                    continue;
                }
            } catch (Exception e) {

            }
        }
    }

    protected void futureResolveData(List arg23) {
        int v3_2 = 0;
        CellRef v3_1;
        Object v2;
        if ((this.isLastReadEnable()) && arg23 != null && (!this.mAppData.be.containsKey(this.mCategoryName) || (((Boolean) this.mAppData.be.get(this.mCategoryName)).booleanValue()))) {
            if (arg23.size() > 0) {
                Iterator v3 = arg23.iterator();
                while (v3.hasNext()) {
                    v2 = v3.next();
                    ((CellRef) v2).l = false;
                    ((CellRef) v2).m = false;
                    if (((CellRef) v2).cellType != -1) {
                        continue;
                    }

                    v3.remove();
                }
            }

            LastReadDataManager.LastReadData v11 = android.support.design.a.j().a(this.mCategoryName);
            if (v11 == null) {
                return;
            }

            int v10 = -1;
            int v5 = -1;
            long v12 = System.currentTimeMillis();
            int v4 = 0;
            while (true) {
                if (v4 < arg23.size() - 1) {
                    v2 = arg23.get(v4);
                    if (v12 - ((CellRef) v2).cateBehotTime * 1000 > 86400000) {
                        if (!this.mRefreshFromDislike && v4 < 60) {
                            break;
                        }

                        v3_1 = new CellRef(-1);
                        v3_1.cateBehotTime = ((CellRef) v2).cateBehotTime;
                        v3_1.B = true;
                        v3_1.C = -1;
                        arg23.add(v4, v3_1);
                        int v2_1 = v4 + 1;
                        --v4;
                        v3_2 = v2_1;
                    } else {
                        v3_1 = null;
                        if (v4 + 1 < arg23.size()) {
                            v3_1 = (CellRef) arg23.get(v4 + 1);
                        }

                        long v14 = v11.cursor;
                        long v8 = ((CellRef) v2).cateCursor;
                        long v6 = v3_1.cateCursor;
                        if (v14 == 0) {
                            v8 = 0;
                            v6 = 0;
                        }

                        if (v11.time > 0 && v11.behotTime * 1000 + v14 <= v8 + ((CellRef) v2).cateBehotTime * 1000 && (v3_1 == null || v11.behotTime * 1000 + v14 >= v3_1.cateBehotTime * 1000 + v6) && ((this.mRefreshFromDislike) || v4 >= 5)) {
                            CellRef v2_2 = new CellRef(-1);
                            v2_2.cateBehotTime = v11.behotTime;
                            v2_2.B = false;
                            v2_2.C = v11.time;
                            v2_2.D = v11.clickable;
                            v2_2.cateCursor = v11.cursor;
                            arg23.add(v4 + 1, v2_2);
                            v3_2 = v4 + 2;
                        } else {
                            ++v4;
                            continue;
                        }
                    }
                } else {
                    v3_2 = v5;
                    v4 = v10;
                }

                break;
            }
            if (v4 >= 0) {
                v2 = arg23.get(v4);
                if (!this.isCellTabVideoStyle(((CellRef) v2)) && ((CellRef) v2).cellType != 36 && ((CellRef) v2).cellType != 43 && ((CellRef) v2).cellType != 44) {
                } else {
                    ((CellRef) v2).l = true;
                }
            }

            if (v3_2 < 0) {
                return;
            }

            if (v3_2 >= arg23.size()) {
                return;
            }

            ((CellRef) arg23.get(v3_2)).m = true;
        }
    }

    public String getCategory() {
        return this.mCategoryName;
    }

    public String getCategoryCity() {
        return this.mCategoryCity;
    }

    public String getCategoryName() {
        return this.mCategoryName;
    }

    protected String getCategoryNameWithTab() {
        return this.mCategoryName + "_" +
                (this.mOnVideoTab ? "video" : "main");
    }

    public long getConcernId() {
        return this.mFeedDataProvider == null ? 0 : ((Long) this.mFeedDataProvider.c.get()).longValue();
    }

    public void getCurrentList(int arg3, List arg4) {
        if (arg4 != null && this.getData() != null && !this.getData().isEmpty()) {
            if (arg3 > 0 && this.getData().size() > arg3) {
                arg4.addAll(this.getData().subList(0, arg3));
                return;
            }
            arg4.addAll(this.getData());
        }
    }

    public List getData() {
        List v0;
        if (this.mFeedDataProvider == null) {
            v0 = this.mData;
        } else {
            v0 = this.mFeedDataProvider.mCellRefList;
        }

        return v0;
    }

    public Bundle getExtraArguments() {
        return null;
    }

    protected int getExtraLayout() {
        return R.layout.article_list_extra;
    }

    public int getFirstVisiblePosition() {
        return this.mListView != null ? this.mListView.getFirstVisiblePosition() - this.mListView.getHeaderViewsCount() : 0;
    }

    public Fragment getFragment() {
        return this;
    }

    protected String getGoDetailLabel() {
        String label = null;
        if ("__all__".equals(this.mCategoryName)) {
            label = "click_headline";
        } else if (!android.support.design.a.isTextEmpty(this.mCategoryName)) {
            label = "click_" + this.mCategoryName;
        }
        return label;
    }

    public String getListCategory() {
        return this.mCategoryName;
    }

    protected ListData getListData() {
        ListData v0;
        if (this.mFeedDataProvider == null) {
            v0 = this.mListData;
        } else {
            v0 = (ListData) this.mFeedDataProvider.h.get();
        }

        return v0;
    }

    public int getListType() {
        return 1;
    }

    public AbsListView getListView() {
        return this.mListView;
    }

    private void getSearchText() {
        int v1_2;
        FragmentActivity v0_1;
        String suggestCategory;
        String from;
        SearchTextHelper searchTextHelper;
        int v2 = 3;
        if (AppData.getInstance().getAbSettings().isSearchRecommendEnable()
                && this.getActivity() instanceof SearchTextHelper.OnSearchTextRefreshListener) {
            try {
                searchTextHelper = SearchTextHelper.getInstance(this.mContext);
                from = "feed";
                suggestCategory = this.getCategory();
                v0_1 = this.getActivity();
                if (!NetworkUtils.isNetworkAvailable(searchTextHelper.mContext)) {
                    return;
                }

                JSONObject jsonObject = new JSONObject();
                if (suggestCategory != null) {
                    try {
                        JSONObject jo = new JSONObject();
                        jo.put("from", from);
                        jo.put("sug_category", suggestCategory);
                        jsonObject.put("suggest_word", jo);
                    } catch (JSONException jsonException) {
                        jsonException.printStackTrace();
                    }
                }

                if (!AppData.getInstance().getAbSettings().isWebSearchEnable()) {
                    v1_2 = 1;
                } else if (AppData.getInstance().getAbSettings().getSearchRecommendNum() == v2) {
                    v1_2 = v2;
                } else {
                    v1_2 = 1;
                }

                searchTextHelper.mSearchTextApi.getSearchHint(jsonObject.toString(), v1_2)
                        .enqueue(new SearchHintCallback(from, suggestCategory, ((SearchTextHelper.OnSearchTextRefreshListener) v0_1)));
            } catch (Throwable throwable) {
            }
        }
    }

    public String getSuffixLabel() {
        return ArticleHelper.getSuffixLabel(this.getListType(), this.mCategoryName);
    }

    private IVideoController getVideoController() {
        return this.getActivity() instanceof IVideoControllerContext ? ((IVideoControllerContext) this.getActivity()).getVideoController() : null;
    }

    public int getViewLayout() {
        return R.layout.article_list;
    }

    public void goSetting() {
        try {
            SettingsActivityHelper.gotoSettingsActivity(this.mContext);
        } catch (Throwable throwable) {
            throwable.printStackTrace();
        }
    }

    public void handleCategoryTip(String arg2, String arg3) {
        if ((this.isViewValid())
                && !android.support.design.a.isTextEmpty(arg2)
                && !android.support.design.a.isTextEmpty(arg3)
                && (arg2.equals(this.mCategoryCity))
                && (this.isPrimaryPage())
                && (!this.isLoading() || !((Boolean) this.mFeedDataProvider.isRefresh.get()).booleanValue())) {
            this.checkCategoryTip();
        }
    }

    public void handleMsg(Message message) {
        if (this.isViewValid()) {
            switch (message.what) {
                case 102: {
                    this.checkCategoryTip(true, true);
                    return;
                }
                default: {
                    super.handleMsg(message);
                    return;
                }
            }
        }
    }

    private void handleRefreshAdScroll(int arg7) {
        ai v0_1;
        if (this.mAdHeader != null && (this.mAdHeader.k())) {
            if (this.mPullRefreshList.getState() == State.RELEASE_TO_REFRESH) {
                if (arg7 > this.mMaxOffset) {
                    this.mMaxOffset = arg7;
                }

                if ((this.mIsAdShowFull) && (this.mIsAdShowPart)) {
                    return;
                }

                int v0 = this.mAdHeader.getAdHeight();
                int v1 = this.mAdHeader.getContentSize();
                if (v0 <= 0) {
                    return;
                }

                if (v1 <= 0) {
                    return;
                }

                if (!this.mIsAdShowFull && arg7 >= v0 + v1) {
                    this.mIsAdShowFull = true;
                    v0_1 = this.mAdHeader;
                    Context v2 = this.mContext;
                    if (v0_1.n != null) {
                        RefreshAdManager.b(v2, v0_1.n, v0_1.m);
                    }
                }

                if (!this.mIsAdShowPart && arg7 > v1) {
                    this.mIsAdShowPart = true;
                    v0_1 = this.mAdHeader;
                    Context v1_1 = this.mContext;
                    if (v0_1.n != null) {
                        RefreshAdManager.a(v1_1, v0_1.n, v0_1.m);
                    }
                }

                this.mIsAdShowPct = false;
            } else {
                if (this.mPullRefreshList.getState() != State.RESET) {
                    return;
                }

                this.mIsAdShowFull = false;
                this.mIsAdShowPart = false;
            }
        }
    }

    public void handleRefreshAdTouchEvent() {
        if (this.mAdHeader != null && (this.mAdHeader.k())) {
            int v0 = this.mAdHeader.getAdHeight();
            if (!this.mIsAdShowPct && v0 > 0) {
                int v1 = this.mAdHeader.getContentSize();
                v0 = this.mMaxOffset >= v0 + v1 ? 100 : ((int) ((((float) (this.mMaxOffset - v1))) / (((float) v0)) * 100f));
                this.mIsAdShowPct = true;
                ai v1_1 = this.mAdHeader;
                if (v1_1.n != null) {
                    RefreshAdManager.a(mContext, v1_1.n, v1_1.m, v0);
                }
                this.mMaxOffset = 0;
            }
        }
    }

    public void handleRefreshClick(int arg6) {
        String v2_1;
        FragmentActivity v1_1;
        String v0;
        int v2 = 2;
        int v1 = 3;
        if ((this.isViewValid()) && this.mFeedDataProvider != null && !this.isLoading()) {
            if (this.isLocalNotRecognized()) {
                this.showNotify(com.ss.android.article.browser.R.string.plz_choose_your_city);
            } else {
                if (arg6 == 1) {
                    if (this.mAppData.getAbSettings().isAppLogOld()) {
                        v0 = this.mHasTips ? "refresh_click_tip" : "refresh_click";
                        this.onCategoryEvent(v0);
                    }

                    if (this.mAppData.getAbSettings().isAppLogNew()) {
                        v0 = this.mHasTips ? "refresh_click_tip" : "click";
                        this.onRefreshEventNew(v0);
                    }

                    this.mRefreshFrom = v2;
                } else {
                    if (arg6 == v1) {
                        MobClickCombiner.onEvent(this.getActivity(), "new_tab", "refresh_guide");
                    } else if (arg6 == v2) {
                        this.mRefreshFrom = v1;
                        if (this.mAppData.getAbSettings().isAppLogOld()) {
                            if ("__all__".equals(this.mCategoryName)) {
                                v1_1 = this.getActivity();
                                v2_1 = "new_tab";
                                v0 = this.mHasTips ? "refresh_new_button_tip" : "refresh_new_button";
                                MobClickCombiner.onEvent(((Context) v1_1), v2_1, v0);
                            } else {
                                v1_1 = this.getActivity();
                                v2_1 = "category";
                                StringBuilder v3 = new StringBuilder();
                                v0 = this.mHasTips ? "refresh_new_button_tip_" : "refresh_new_button_";
                                MobClickCombiner.onEvent(((Context) v1_1), v2_1, v3.append(v0).append(this.mCategoryName).toString());
                            }
                        }

                        if (!this.mAppData.getAbSettings().isAppLogNew()) {
                        } else {
                            v0 = this.mHasTips ? "refresh_new_button_tip" : "new_button";
                            this.onRefreshEventNew(v0);
                        }
                    } else if (arg6 == 4) {
                        this.mRefreshFrom = v1;
                        if (this.mAppData.getAbSettings().isBackRefreshInCategoryAll()) {
                        } else {
                            this.onBackPressRefreshEvent();
                            this.mRefreshFrom = 10;
                        }
                    } else {

                        this.mRefreshFrom = 1;
                        if (this.mAppData.getAbSettings().isAppLogOld()) {
                            if ("__all__".equals(this.mCategoryName)) {
                                v1_1 = this.getActivity();
                                v2_1 = "new_tab";
                                v0 = this.mHasTips ? "tab_refresh_tip" : "tab_refresh";
                                MobClickCombiner.onEvent(((Context) v1_1), v2_1, v0);
                            } else {
                                v1_1 = this.getActivity();
                                v2_1 = "category";
                                v0 = this.mHasTips ? "tab_refresh_tip_" + this.mCategoryName : "tab_refresh_" + this.mCategoryName;
                                MobClickCombiner.onEvent(((Context) v1_1), v2_1, v0);
                            }
                        }

                        if (!this.mAppData.getAbSettings().isAppLogNew()) {
                        } else {
                            v0 = this.mHasTips ? "tab_refresh_tip" : "tab";
                            this.onRefreshEventNew(v0);
                        }
                    }
                }

                this.mFeedDataProvider.v = System.currentTimeMillis();
                this.mPullRefreshList.setRefreshing(true);
            }
        }
    }

    private boolean isCellTabVideoStyle(CellRef arg6) {
        int v4 = 2;
        int v0 = TTUtils.getScreenWidth(this.mContext);
        int v1 = TTUtils.getScreenHeight(this.mContext);
        int v2 = v0 - (this.getResources().getDimensionPixelOffset(R.dimen.feed_item_horizontal_margin) << 1);
        if (v1 > 0) {
            v0 = v1;
        }

        v0 *= 2;
        boolean v0_1 = arg6.cellType != 0 || ArticleFeedViewHolder.a(arg6, v2, v0, this.mNetworkMonitor) != v4 || arg6.videoStyle <= v4 ? false : true;
        return v0_1;
    }

    public boolean isInListViewTop() {
        boolean v0 = true;
        AbsListView v2 = this.getListView();
        if (v2 != null && ((AdapterView) v2).getChildCount() > 0) {
            if (((AdapterView) v2).getFirstVisiblePosition() <= 0) {
                View v2_1 = ((AdapterView) v2).getChildAt(0);
                if (v2_1 != null) {
                    if (v2_1.getTop() != 0) {
                        v0 = false;
                    } else {
                    }

                    return v0;
                }
            }

            v0 = false;
        }

        return v0;
    }

    public boolean isLoading() {
        return this.mFeedDataProvider != null && ((Boolean) this.mFeedDataProvider.d.get()).booleanValue();
    }

    public boolean isLoadingLocal() {
        return this.isLoading() && this.mIsLoadingLocal;
    }

    private boolean isLocalNotRecognized() {
        return false;
    }

    public boolean isPrimaryPage() {
        FragmentActivity v0 = this.getActivity();
        boolean v0_1 = (v0 instanceof IFeedManager) ? ((IFeedManager) v0).isPrimaryPage(((IRecentFragment) this)) : true;
        return v0_1;
    }

    public boolean isPullingToRefresh() {
        boolean v0 = !this.isLoading() || !((Boolean) this.mFeedDataProvider.isRefresh.get()).booleanValue() ? false : true;
        return v0;
    }

    public void notifyAdapterListScroll() {
        boolean v0 = true;
        if (this.mAdapter != null) {
            if (this.mNotifyViewHelper != null) {
                int v2 = this.mNotifyViewHelper.c() == 0 ? 1 : 0;
                if (v2 != 0) {
                    v0 = false;
                }
            } else {
                v0 = false;
            }
            this.mAdapter.a(v0);
        }
    }

    public void onActivityCreated(Bundle arg3) {
        new StringBuilder("ArticleRecentFragment#onActivityCreatedBegin:").append(this.getCategoryName());
        com.ss.android.l.c.c();
        super.superOnActivityCreated(arg3);
        if (!this.supportLazyLoad() || (this.isPrimaryPage())) {
            this.doOnActivityCreated();
        }

        new StringBuilder("ArticleRecentFragment#onActivityCreatedEnd:").append(this.getCategoryName());
        com.ss.android.l.c.c();
    }

    public void onActivityResult(int arg2, int arg3, Intent arg4) {
        if (arg2 != 110) {
            super.onActivityResult(arg2, arg3, arg4);
        } else if (arg3 == -1 && this.mAppData != null) {
            this.mPendingDetailResult = true;
        }
    }

    public void onAdDeleted(long arg4) {
        super.onAdDeleted(arg4);
        if (this.mAdHeader != null && (this.mAdHeader.k()) && arg4 == this.mAdHeader.getCurrentAd().mCreativeId) {
            this.mAdHeader.n = null;
            this.mAdHeader.b.setVisibility(View.INVISIBLE);
        }
    }

    public void onArticleListReceived(boolean arg8, boolean arg9, boolean arg10, boolean arg11) {
        com.ss.android.l.c.c();
        if ((this.isViewValid()) && (arg11)) {
            if (arg8) {
                this.mListView.setSelection(0);
            }

            if ((!arg10 || !this.mNetworkMonitor.isNetworkOn()) && (this.mIsBackRefresh)) {
                this.mIsBackRefresh = false;
                FragmentActivity v0 = this.getActivity();
                if ((v0 instanceof FeedTab)) {
                    ((FeedTab) v0).onBackPressRefresh();
                }
            }

            if (!this.getData().isEmpty() && (!arg10 || !this.mNetworkMonitor.isNetworkOn()) && (this.isPrimaryPage())) {
                if (this.mAppData.getAppSettings().isFirstRefreshTips()) {
                    this.mAppData.getAppSettings().setFirstRefreshTips(false);
                    this.mHandler.sendEmptyMessageDelayed(102, (((long) this.mAppData.getAppSettings().getFirstRefreshTipsInterval())) * 1000);
                } else {
                    this.checkCategoryTip();
                }
            }

            if (this.dislikeDialogManager != null) {
                m v0_1 = this.dislikeDialogManager;
                Object v0_2 = v0_1.b != null ? v0_1.b.get() : null;
                if (v0_2 == null) {
                } else if (!((DislikeDialog) v0_2).isShowing()) {
                } else {

                    ((DislikeDialog) v0_2).dismiss();
                }
            }

            if (!arg9 && (arg8)) {
                this.mPendingPullRefresh = false;
                return;
            }

            if (!this.mPendingPullRefresh) {
                return;
            }

            if (!arg9) {
                return;
            }

            this.refreshByCategoryTip();
        }
    }

    private void onBackPressRefreshEvent() {
        Bundle v0 = new Bundle();
        v0.putString("category_name", this.mCategoryName);
        v0.putString("refresh_type", "click_return");
        v0.putInt("refer", this.mReferType);
        if (this.mAdapter.mConcernId > 0) {
            v0.putString("concern_id", String.valueOf(this.mAdapter.mConcernId));
        }

        android.support.design.a.onEvent("category_refresh", v0);
    }

    public Object onCallback(Object[] args) {
        Object v2 = null;
        if (args != null && args.length > 0 && (BaseAppData.callbackTypeCityChangeClient.equals(args[0]))) {
            this.mPendingChoseCityResult = true;
            if (this.checkCityChange()) {
                CallbackCenter.abortDispatch();
            }
        }

        return v2;
    }

    protected void onCategoryEvent(String arg1) {
        super.onCategoryEvent(arg1);
    }

    protected void onCategoryEvent(String arg10, boolean arg11) {
        String v3;
        long v4 = 0;
        String v2 = "new_tab";
        if (!"__all__".equals(this.mCategoryName)) {
            v2 = "category";
            if (!arg11) {
                v3 = arg10;
            } else if (arg10 == null) {
                v3 = arg10;
            } else if (this.mCategoryName != null) {
                v3 = arg10 + "_" + this.mCategoryName;
            } else {
                v3 = arg10;
            }
        } else {
            v3 = arg10;
        }

        com.ss.android.article.base.utils.JSONObjectWrapper v0 = new com.ss.android.article.base.utils.JSONObjectWrapper();
        v0.put("category_id", this.mCategoryName);
        v0.put("refer", this.mReferType);
        v0.put("concern_id", this.getConcernId());
        MobClickCombiner.onEvent(this.getActivity(), v2, v3, v4, v4, v0.jsonObject);
    }

    protected void onClickNotifyCancel(int arg1) {
        switch (arg1) {
            case 100: {
                break;
            }
            default: {
                super.onClickNotifyCancel(arg1);
                break;
            }
        }
    }

    protected void onClickNotifyText(int arg3) {
        switch (arg3) {
            case 100: {
                if ((this.isViewValid()) && !this.isLoading()) {
                    this.mRefreshFrom = 5;
                    this.mPullRefreshList.setRefreshing(true);
                }

                break;
            }
            default: {
                super.onClickNotifyText(arg3);
                break;
            }
        }
    }

    public void onConfigurationChanged(Configuration arg3) {
        super.onConfigurationChanged(arg3);
        if (arg3.orientation == 1 && (this.getUserVisibleHint())) {
            this.updateSubEntrance();
        }
    }

    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        Bundle v0 = this.getArguments() == null ? this.getExtraArguments() : this.getArguments();
        if (v0 != null) {
            this.mCategoryName = v0.getString("category");
            this.mCategoryId = v0.getString("category_id");
        }

        if (this.mMonitorFPS == null && (com.bytedance.article.common.a.g.a())) {
            this.mMonitorFPS = new MonitorFPS(this.getContext(), "feed");
        }
    }

    public void onDayNightThemeChanged(Resources resources, boolean isNightMode) {
        int v9 = R.color.activity_bg_color;
        super.onDayNightThemeChanged(resources, isNightMode);
        FeedCellStyleConfig.adaptCellNightMode(this.mListView);
        if (this.mSubchannelLayoutList != null && this.mSubchannelLayoutList.size() > 0) {
            int v4;
            for (v4 = 0; v4 < this.mSubchannelLayoutList.size(); ++v4) {
                Object v2 = this.mSubchannelLayoutList.get(v4);
                if (v2 != null) {
                    FeedCellStyleConfig.setCellBackgroundColor(((View) v2), this.getResources().getColor(v9));
                    ViewParent v0 = ((LinearLayout) v2).getParent();
                    if (v0 != null) {
                        FeedCellStyleConfig.setCellBackgroundColor(((View) v0), this.getResources().getColor(v9));
                        int v1;
                        for (v1 = 0; v1 < ((LinearLayout) v0).getChildCount(); ++v1) {
                            View v5 = ((LinearLayout) v0).getChildAt(v1);
                            if ((v5 instanceof ImageView)) {
                                v5.setBackgroundColor(this.getResources().getColor(com.ss.android.article.browser.R.color.ssxinxian1));
                            }
                        }
                    }

                    int v6 = ((LinearLayout) v2).getChildCount();
                    int v5_1;
                    for (v5_1 = 0; v5_1 < v6; ++v5_1) {
                        View v1_1 = ((LinearLayout) v2).getChildAt(v5_1);
                        if ((v1_1 instanceof TextView)) {
                            ((TextView) v1_1).setTextColor(this.getResources().getColorStateList(com.ss.android.article.browser.R.color.btn_common_text));
                            v1_1.setBackgroundResource(com.ss.android.article.browser.R.drawable.bv);
                        }
                    }
                }
            }
        }

        if (this.mAdHeader != null) {
            RefreshAdManager.o$a v0_1 = RefreshAdManager.a(this.mContext).a(this.mCategoryName);
            if (v0_1 != null) {
                this.mAdHeader.a(v0_1, this.mCategoryName);
            } else {
                this.mAdHeader.n = null;
            }
        }
    }

    public void onDeleteFavorClick(CellRef arg1) {
    }

    public void onDestroy() {
        super.onDestroy();
        this.mAdapter = null;
        this.tryCancelPrevQuery();
        CallbackCenter.removeCallback(BaseAppData.callbackTypeCityChangeClient, this);
        android.support.design.a.b(((Map) null));
        ArticleHelper.c = false;
        if (this.mTaskInfo != null) {
            this.mTaskInfo.a = true;
        }

        if (this.mAuthorVideoAvatarLoader != null) {
            this.mAuthorVideoAvatarLoader.onDestroy();
        }
        this.mAuthorVideoAvatarLoader = null;
    }

    public void onDestroyView() {
        Object v0;
        super.onDestroyView();
        if (this.mDataBinding != null) {
            this.mDataBinding.c();
        }

        if (this.mFeedDataProvider != null) {
            com.ss.android.article.base.feature.feed.a.a v1 = com.ss.android.article.base.feature.feed.a.a.a();
            FeedDataProvider v2 = this.mFeedDataProvider;
            Iterator v3 = v1.b.entrySet().iterator();
            do {
                if (v3.hasNext()) {
                    v0 = v3.next();
                    if (((Map.Entry) v0).getValue() != v2) {
                        continue;
                    }

                    v1.b.remove(((Map.Entry) v0).getKey());
                }

                break;
            }
            while (true);
        }
        SubscriptionRouter.removeSubscriber(this);
    }

    public void onEnterFromOtherCategory() {
        boolean v1 = true;
        FragmentActivity fragmentActivity = (this.getActivity() instanceof IFeedManager) ? this.getActivity() : null;
        boolean v0_1 = fragmentActivity == null || !((IFeedManager) fragmentActivity).getUseTabTip() ? false : true;
        if (TextUtils.isEmpty(this.mAppData.a(this.mCategoryCity, v0_1, true, false))) {
            v1 = false;
        }

        this.mPendingPullRefresh = v1;
        if ((this.mPendingPullRefresh) && !this.isLoading() && !this.getData().isEmpty()) {
            this.refreshByCategoryTip();
        }
    }

    public void onEvent(String arg3) {
        MobClickCombiner.onEvent(this.getActivity(), "new_tab", arg3);
    }

    public void onEvent(String arg10, BaseArticle arg11) {
        long v6 = 0;
        if (arg11 != null && arg11.groupId > v6) {
            JSONObject v8 = new JSONObject();
            try {
                v8.put("item_id", arg11.itemId);
                v8.put("aggr_type", arg11.aggrType);
            } catch (JSONException v0) {
            }

            MobClickCombiner.onEvent(this.getActivity(), "new_tab", arg10, arg11.groupId, v6, v8);
        }
    }

    protected void onLoadMoreClick() {
        this.mLoadMoreFrom = 1;
        super.onLoadMoreClick();
    }

    static void onLocationPermissionEvent() {
        Bundle v1 = new Bundle();
        String v2 = "grant_location";
        int v0 = PermissionsManager.getInstance().a(AbsApplication.getApplication(), "android.permission.ACCESS_COARSE_LOCATION") ? 1 : 0;
        v1.putInt(v2, v0);
        android.support.design.a.onEvent("request_permission", v1);
    }

    public void onPause() {
        super.onPause();
        this.mActiveStayDuration += System.currentTimeMillis() - this.mResumeTime;
        this.mResumeTime = 0;
    }

    public void onPullRefresh() {
        int v2 = -1;
        if (this.isLoading()) {
            this.showNotify(com.ss.android.article.browser.R.string.ss_hint_loading);
            this.mPullRefreshList.onRefreshComplete();
            this.mRefreshFrom = v2;
        } else if (this.isLocalNotRecognized()) {
            this.showNotify(com.ss.android.article.browser.R.string.plz_choose_your_city);
            this.mPullRefreshList.onRefreshComplete();
            this.mRefreshFrom = v2;
        } else {
            this.mIsPullingToRefresh = true;
            this.enableLoadMoreTimeStamp(false);
            if ((this.checkLoginStatus()) && !this.getData().isEmpty()) {
                this.getData().clear();
                this.getListData().a();
                this.refreshList();
                if (this.mSpipe.isLogin) {
                    this.getListData().f = 0;
                } else {
                    this.getListData().f = 1;
                }
            }

            this.mForce = true;
            this.queryData();
            this.dismissVideo();
        }
    }

    public void onQueryNetwork(boolean isRefreshing) {
        int v0 = 0;
        if (this.isViewValid()) {
            this.mIsLoadingLocal = false;
            if (isRefreshing) {
                this.mPendingPullRefresh = false;
            }

            this.updateLoadingStatus();
            if (this.getData() == null || this.getData().size() <= 0) {
                v0 = 1;
            }

            if (!isRefreshing) {
                return;
            }

            if (!this.isLoading()) {
                return;
            }

            if (this.mPullRefreshList == null) {
                return;
            }

            if (this.mPullRefreshList.c()) {
                return;
            }

            if (v0 != 0) {
                return;
            }

            if (this.mFeedDataProvider.q) {
                return;
            }

            this.mPullRefreshList.e();
        }
    }

    public void onRefreshEventNew(String arg2) {
        this.onRefreshEventNew(arg2, null);
    }

    private void onRefreshEventNew(String arg4, JSONObject arg5) {
        JSONObjectWrapper v0 = new JSONObjectWrapper();
        v0.put("category_name", this.mCategoryName).put("refresh_type", arg4);
        if (AppData.getInstance().getAbSettings().isApplogStaging()) {
            v0.put("_staging_flag", Integer.valueOf(1));
        }

        v0.put(arg5);
        android.support.design.a.onEvent("category_refresh", v0.jo);
    }

    public void onResume() {
        int v5_1;
        int v0_1;
        int v4 = -1;
        this.ensureInitialized();
        super.onResume();
        if (this.isLastReadEnable()) {
            LastReadDataManager.LastReadData v0 = android.support.design.a.j().a(this.mCategoryName);
            if (v0 != null) {
                this.mLastReadTime = v0.time;
                this.mLastMaxBehotTime = v0.nextBehotTime;
            }
        }

        this.mResumeTime = System.currentTimeMillis();
        if (this.mFirstResume) {
            v0_1 = !this.mAppData.getAbSettings().isSilenceRefreshOpen() || !this.mAppData.meetSilenceTime() ? 0 : 1;
            this.mFirstResume = false;
            this.updateLoadingStatus();
        } else {
            v0_1 = 1;
        }

        int v3 = !this.mPendingDetailResult || (this.isLoading()) ? 0 : 1;
        if (v3 != 0) {
            ListData v5 = this.mAppData.a(1, this.mCategoryName);
            if (v5 == null || v5.a == null || v5.a.size() < this.getData().size()) {
                v0_1 = 0;
                v3 = v4;
            } else {
                v3 = v5.b;
                if (v5.a.size() > this.getData().size()) {
                    List v0_2 = v5.a;
                    Spipe v6 = this.mSpipe;
                    v0_1 = v0_2 == null || (v0_2.isEmpty()) ? 1 : 0;
                    if (v6.isLogin) {
                        if (v0_1 == 0 && v5.f != 0) {
                            v0_1 = 0;
                        } else {
                            v0_1 = 1;
                        }
                    } else {
                        if (v0_1 == 0 && v5.f != 1) {
                            v0_1 = 0;
                        } else {
                            v0_1 = 1;
                        }
                    }

                    if (v0_1 == 0) {
                        v0_1 = 0;
                    }

                    this.getListData().a(v5);
                    this.getData().clear();
                    this.getData().addAll(v5.a);
                    if (this.mAdapter != null) {
                        v3 = this.refreshList(v3);
                        v0_1 = 1;
                    } else {
                        v0_1 = 0;
                    }
                    this.mPendingChoseCityResult = false;
                } else {
                    v0_1 = 0;
                }
            }

            this.mAppData.bu.clear();
            v5_1 = 0;
        } else {
            v3 = v4;
            v5_1 = v0_1;
            v0_1 = 0;
        }

        if (this.getData() == null || !this.getData().isEmpty() || (this.isLoading()) || (this.mPendingChoseCityResult)) {
            if (!this.mPendingChoseCityResult) {
            } else {
                this.checkCityChange();
                v0_1 = 1;
                v3 = v4;
                v5_1 = 0;
            }
        } else if (this.isPrimaryPage()) {
            if (!this.isLocalNotRecognized()) {
                this.queryData();
            }
            v5_1 = 0;
        } else {
            v5_1 = 0;
        }

        this.mPendingChoseCityResult = false;
        if (!this.isPrimaryPage()) {
            v5_1 = 0;
        } else if ((this.checkLoginStatus()) && !this.isLoading() && !this.getData().isEmpty() && (this.mNetworkMonitor.isNetworkOn())) {
            this.getData().clear();
            this.getListData().a();
            this.refreshList();
            if (this.mSpipe.isLogin) {
                this.getListData().f = 0;
            } else {
                this.getListData().f = 1;
            }

            if (!this.isLocalNotRecognized()) {
                this.mIsPullingToRefresh = true;
                this.queryData();
            }

            v0_1 = 1;
            v3 = v4;
            v5_1 = 0;
        }

        this.mPendingDetailResult = false;
        if (ArticleHelper.c) {
            v0_1 = 1;
        }

        ArticleHelper.c = false;
        if (v0_1 == 0) {
            v3 = this.refreshList(v3, false);
        }

        this.setSelectionFromTop(v3);
        if (!this.isLoading() && v5_1 != 0 && this.getData() != null && !this.getData().isEmpty() && ((this.getActivity() instanceof IFeedManager)) && (this.mNetworkMonitor.isNetworkOn())) {
            if (this.mAppData.b(this.mCategoryCity)) {
                if (!this.mAppData.getAbSettings().isSilenceRefreshOpen()) {
                } else if (this.mAppData.bq) {
                    this.mRefreshFrom = 4;
                    this.mIsPullingToRefresh = true;
                    this.mAppData.bq = false;
                    this.mAppData.bp = this.mAppData.b(this.mCategoryCity);
                    this.queryData();
                }
            } else {
                label_160:
                this.mRefreshFrom = 4;
                this.mIsPullingToRefresh = true;
                this.mAppData.bq = false;
                this.mAppData.bp = this.mAppData.b(this.mCategoryCity);
                this.queryData();
            }
        }

        if (!this.isLoading() && this.getData() != null && !this.getData().isEmpty() && (this.isPrimaryPage())) {
            this.checkCategoryTip();
        }

        if (com.ss.android.article.base.utils.f.a) {
            com.ss.android.article.base.utils.f.a(this.getActivity());
        }

        if (this.mAuthorVideoAvatarLoader != null) {
            this.mAuthorVideoAvatarLoader.onPause();
        }

        if (("__all__".equals(this.mCategoryName))
                && this.getVideoController() != null
                && (this.getVideoController().isPauseFromList())) {
            this.checkPlayVideo(true);
        }
    }

    public void onScroll(AbsListView arg2, int arg3, int arg4, int arg5) {
        super.onScroll(arg2, arg3, arg4, arg5);
        if (arg5 > 1 && arg5 <= arg3 + arg4 + 5 && arg5 >= this.getData().size()) {
            this.onScrollBottom();
        }

        this.notifyAdapterListScroll();
    }

    public void onScrollBottom() {
        if (this.mFeedDataProvider != null && !this.isLoading() && !this.getData().isEmpty()) {
            this.mFooter.hideFooterContent();
            if (!this.getListData().c && !this.getListData().d) {
                this.mFooter.hideFooterContent();
                return;
            }

            if (this.mNetworkMonitor.isNetworkOn()) {
                if (this.getListData().c) {
                    if (!this.isActive()) {
                        return;
                    }

                    if (!this.mFeedDataProvider.b()) {
                        return;
                    }

                    this.mRefreshFromString = "pre_load_more";
                    if (this.mAppData.getAbSettings().isAppLogOld()) {
                        this.onCategoryEvent("pre_load_more");
                    }

                    if (this.mAppData.getAbSettings().isAppLogNew()) {
                        this.onRefreshEventNew("pre_load_more");
                    }

                    this.mIsPullingToRefresh = false;
                    this.mFooter.switchToLoading();
                    this.queryData();
                    return;
                }

                this.mFooter.switchToNoMoreContent(com.ss.android.article.browser.R.string.no_more_content);
                return;
            }

            if (!this.getListData().d) {
                return;
            }

            this.mFooter.hideFooterContent();
            this.mRefreshFromString = "pre_load_more";
            if (this.mAppData.getAbSettings().isAppLogOld()) {
                this.onCategoryEvent("pre_load_more");
            }

            if (this.mAppData.getAbSettings().isAppLogNew()) {
                this.onRefreshEventNew("pre_load_more");
            }

            this.mIsPullingToRefresh = false;
            this.queryData();
        }
    }

    public void onScrollStateChanged(AbsListView arg12, int arg13) {
        int v6_2;
        int v1_1;
        int v8;
        FeedAdapter v7;
        int v10 = 2;
        super.onScrollStateChanged(arg12, arg13);
        if (this.mAdapter != null) {
            v7 = this.mAdapter;
            boolean v2 = arg13 == v10 ? true : false;
            int v5;
            for (v5 = 0; v5 < v7.mFeedPresenterList.size(); ++v5) {
                ((FeedPresenter) v7.mFeedPresenterList.get(v5)).a(v2);
            }

            if (v7.i.get() == v2) {
            } else {

                v7.i.set(v2);
                if (v2) {
                } else {

                    Object v6 = v7.mRefListView != null ? v7.mRefListView.get() : null;
                    if (v6 == null) {
                    } else {
                        v8 = ((ListView) v6).getChildCount();
                        for (v5 = 0; v5 < v8; ++v5) {
                            View v9 = ((ListView) v6).getChildAt(v5);
                            int v2_1;
                            for (v2_1 = 0; v2_1 < v7.mFeedPresenterList.size(); ++v2_1) {
                                ((FeedPresenter) v7.mFeedPresenterList.get(v2_1)).a(v9);
                            }
                        }
                    }
                }
            }
        }

        if (arg13 != 0 && this.mMonitorFPS != null) {
            this.mMonitorFPS.b();
        }

        if (arg13 != 0) {
        } else if (this.mListView == null) {
            return;
        } else if (this.mAdapter == null) {
            return;
        } else if (!this.isViewValid()) {
            return;
        } else {
            try {
                if (!this.mNetworkMonitor.isNetworkOn()) {
                } else {
                    v7 = this.mAdapter;
                    v1_1 = this.mListView.getLastVisiblePosition() - this.mListView.getHeaderViewsCount();
                    if (v7.isDestroyed) {
                    } else if (v1_1 < 0) {
                    } else if (v1_1 >= v7.mCellRefList.size()) {
                    } else if (v7.mNetworkStatusMonitor == null) {
                    } else {
                        NetworkType v6_1 = v7.mNetworkStatusMonitor.mCurrrentNetworkType;
                        int v5 = !v7.mAppData.getAbSettings().isLoadImage4G() || v6_1 != NetworkType.MOBILE_4G ? 0 : 1;
                        if (v6_1 == null) {
                        } else if (v6_1 == NetworkType.NONE) {
                        } else {
                            int v2_1 = v7.mPreloadCountMax;
                            if (v6_1 != NetworkType.WIFI && v5 == 0) {
                                v5 = v7.mAppData.mLoadImagePref;
                                if (v5 == 0) {
                                    v2_1 = v7.mPreloadCountNormal;
                                } else if (v5 == v10) {
                                    v2_1 = v7.mPreloadCountMin;
                                }
                            }

                            if (v2_1 <= 0) {
                            } else {
                                v8 = Math.min(v7.mCellRefList.size(), v2_1 + v1_1);
                                v5 = 0;
                                v6_2 = v1_1;
                                while (true) {
                                    if (v6_2 >= v8) {
                                        break;
                                    }
                                    Object v2_2 = v7.mCellRefList.get(v6_2);
                                    v1_1 = v5;
                                    v5 = 0;
                                    while (true) {
                                        if (v5 >= v7.mFeedPresenterList.size()) {
                                            v5 = v1_1;
                                            ++v6_2;
                                            break;
                                        }

                                        if (v1_1 != 0) {
                                            v1_1 = 1;
                                        } else if (!v7.mFeedPresenterList.get(v5).b(((CellRef) v2_2))) {
                                            v1_1 = 0;
                                        } else {
                                            v1_1 = 1;
                                        }
                                        ++v5;
                                        continue;
                                    }
                                }
                            }
                        }
                    }
                }
            } catch (Exception v1) {

            }
        }

        if ((this.mContext instanceof IFeedManager)) {
            ((IFeedManager) this.mContext).onListViewScrollStateChanged(arg13);
        }

        if (arg13 == 0) {
            this.checkPlayVideo(false);
        }
    }

    public void onSetAsPrimaryPage(int arg8) {
        int v0_1;
        this.ensureInitialized();
        if (arg8 == 1 && !this.getUserVisibleHint()) {
            this.mEnterEventContext.clear();
            this.setUserVisibleHint(true);
        }

        if (!this.isViewValid()) {
            Logger.v("ArticleRecentFragment", "onSetAsPrimaryPage !viewValid " + this.mCategoryCity);
        } else {
            this.requestLocationPermission();
            if (this.getData().isEmpty()) {
                this.showLoadingAnim();
            }
            Logger.v("ArticleRecentFragment", "onSetAsPrimaryPage " + this.mCategoryCity + " " + this.isLoading());
            this.updateLoadingStatus();
            boolean v0 = this.checkLoginStatus();
            if (this.isLoading()) {
                this.checkCategoryTip(false);
                return;
            }

            if (!this.mLocalNewsFailedSent && (this.isLocalNotRecognized())) {
                this.mLocalNewsFailedSent = true;
                this.onCategoryEvent("local_news_failed", false);
            }

            if (this.mAppData.D()) {
                CallbackCenter.notifyCallback(BaseAppData.callbackTypeEnablePostStateChanged, new Object[]{Integer.valueOf(this.mShowEtStatus), this.mCategoryName, this.mFeedDataProvider.c.get(), this.mPostContentHint});
            }

            if (("news_local".equals(this.mCategoryName)) && (this.checkCityChange())) {
                return;
            }

            if (!v0 || (this.getData().isEmpty()) || !this.mNetworkMonitor.isNetworkOn()) {
                if (this.getData().isEmpty()) {
                    v0_1 = 1;
                } else if (!android.support.design.a.isTextEmpty(this.mCategoryName)) {
                    v0_1 = !this.mAppData.b(this.mCategoryCity) ? 1 : 0;
                    if (v0_1 != 0 && (this.mNetworkMonitor.isNetworkOn())) {
                        this.mRefreshFrom = 0;
                    } else {
                        v0_1 = 0;
                    }
                } else {
                    v0_1 = 0;
                }

                if (v0_1 != 0) {
                    this.doPullDownToRefresh();
                    v0_1 = 0;
                } else {
                    if (this.mIsBackRefresh) {
                        this.mIsBackRefresh = false;
                        FragmentActivity v0_2 = this.getActivity();
                        if ((v0_2 instanceof FeedTab)) {
                            ((FeedTab) v0_2).onBackPressRefresh();
                        }
                    }
                    v0_1 = 1;
                }
            } else {
                this.getData().clear();
                this.getListData().a();
                this.refreshList();
                if (this.mSpipe.isLogin) {
                    this.getListData().f = 0;
                } else {
                    this.getListData().f = 1;
                }

                this.queryData();
                v0_1 = 0;
            }

            if (v0_1 != 0) {
                this.checkCategoryTip();
            } else {
                this.checkCategoryTip(false);
            }

            if (this.mAdapter == null) {
                return;
            }

            this.mAdapter.onPrimaryPageChanged(true);
        }
    }

    public void onStop() {
        super.onStop();
        if (this.mAuthorVideoAvatarLoader != null) {
            this.mAuthorVideoAvatarLoader.onStop();
        }
    }

    private void onSubChannelShowEvent(final List<SubEntrance> entranceList) {
        if (entranceList.size() != 0) {
            this.mSearchLayout.post(new Runnable() {
                public final void run() {
                    Bundle bundle = new Bundle();
                    StringBuilder wordValue = new StringBuilder();
                    int wordNum = mSearchLayout.getDisplayNumbers();
                    for (int i = 0; i < wordNum; ++i) {
                        SubEntrance world = entranceList.get(i);
                        if (i != wordNum - 1) {
                            wordValue.append(world.name + ",");
                        } else {
                            wordValue.append(world.name);
                        }
                    }

                    bundle.putInt("word_num", wordNum);
                    bundle.putString("word_value", String.valueOf(wordValue));
                    android.support.design.a.onEvent("channel_word_show", bundle);
                }
            });
        }
    }

    public void onUnsetAsPrimaryPage(int arg3) {
        if (arg3 == 1 && (this.getUserVisibleHint())) {
            this.setUserVisibleHint(false);
        }

        if (this.mAdapter != null) {
            this.mAdapter.onPrimaryPageChanged(false);
        }
    }

    protected void onVideoDislike() {
        if (this.getVideoController() != null) {
            IVideoController v0 = this.getVideoController();
            if (v0.isVideoVisible()) {
                v0.releaseMedia();
            }
        }
    }

    public void onViewCreated(View view, Bundle bundle) {
        com.ss.android.l.c.c();
        this.mRootView = view;
        super.superOnViewCreated(view, bundle);
        if (!this.supportLazyLoad() || (this.isPrimaryPage())) {
            this.doOnViewCreated(this.mRootView);
        }
        com.ss.android.l.c.c();
    }

    public void onViewScrollChanged(int arg2, int arg3, int arg4, int arg5) {
        super.onViewScrollChanged(arg2, arg3, arg4, arg5);
        this.notifyAdapterListScroll();
        this.handleRefreshAdScroll(-arg3);
    }

    public void onViewStateRestored(Bundle arg2) {
        super.onViewStateRestored(arg2);
        if (this.mPullRefreshList != null && (this.mPullRefreshList.c())) {
            this.mPullRefreshList.onRefreshComplete();
        }
    }

    public void queryData() {
        ArticleQueryObj v12_1;
        long cateBehotTime;
        int refreshFrom = this.mRefreshFrom;
        boolean force = this.mForce;
        this.mForce = false;
        this.mLoadMoreFrom = 0;
        this.mRefreshFrom = -1;
        String refreshFromString = this.mRefreshFromString;
        if (TextUtils.isEmpty(refreshFromString)) {
            switch (refreshFrom) {
                case 1: {
                    refreshFromString = this.mHasTips ? "tab_tip" : "tab";
                    break;
                }
                case 2: {
                    if (this.mHasTips) {
                        refreshFromString = "click_tip";
                    } else {
                        refreshFromString = "click";
                    }
                    break;
                }
            }
        }

        this.mRefreshFromString = null;
        if (!this.isLoading() || (force)) {
            this.mIsLoadingLocal = true;
            if (this.getActivity() != null && this.mFeedDataProvider != null) {
                if (this.mIsPullingToRefresh) {
                    FeedRefreshFromInfo refreshFromInfo = FeedRefreshFromInfo.create(refreshFrom, refreshFromString);
                    this.mFeedDataProvider.a(refreshFromInfo, force);
                } else {
                    FeedDataProvider feedDataProvider = this.mFeedDataProvider;
                    FeedRefreshFromInfo v30 = new FeedRefreshFromInfo();
                    v30.refreshFromString = refreshFromString;
                    if (feedDataProvider.a(false, v30.c)) {
                        if (((Boolean) feedDataProvider.isRefresh.get()).booleanValue()) {
                            feedDataProvider.a(v30);
                        } else if (feedDataProvider.b()) {
                            String v11 = v30.refreshFromString;
                            if (!"pre_load_more".equals(v11)) {
                                v11 = "load_more";
                                if (AppData.getInstance().getAbSettings().isAppLogOld()) {
                                    feedDataProvider.a("load_more");
                                }

                                if (!AppData.getInstance().getAbSettings().isAppLogNew()) {

                                } else {
                                    feedDataProvider.a("load_more", null);
                                }
                            }

                            feedDataProvider.n = false;
                            feedDataProvider.d.set(Boolean.valueOf(true));
                            ++feedDataProvider.j;
                            long v4_1 = 0;
                            if (!((Boolean) feedDataProvider.isRefresh.get()).booleanValue()) {
                                cateBehotTime = ((CellRef) feedDataProvider.mCellRefList.get(feedDataProvider.mCellRefList.size() - 1)).cateBehotTime;
                                if (feedDataProvider.h.get().h > 0) {
                                    if (feedDataProvider.h.get().h >= cateBehotTime && cateBehotTime > 0) {
                                        v4_1 = cateBehotTime;
                                    } else {
                                        v4_1 = feedDataProvider.h.get().h;
                                    }
                                } else {
                                    v4_1 = cateBehotTime;
                                }

                                Logger.v("FeedDataProvider", "query bottom: " + feedDataProvider.h.get().h + " " + cateBehotTime);
                                if (v4_1 <= 0) {

                                } else {
                                    feedDataProvider.w = System.currentTimeMillis();
                                }
                            }

                            long v8 = v4_1;
                            boolean v2_1 = false;
                            if (NetworkUtils.getNetworkType(BaseApplication.getApplication()) == NetworkType.NONE) {
                                v2_1 = true;
                            }

                            boolean v5 = !feedDataProvider.mCategoryInfo.mIsFromConcernDetailVideo && v2_1;
                            refreshFrom = feedDataProvider.j;
                            String v4_2 = feedDataProvider.mCategoryInfo.mCategoryName;
                            cateBehotTime = 0;
                            String v12 = feedDataProvider.mCategoryInfo.mExtra;
                            EnumSet v13 = feedDataProvider.mCategoryInfo.mOnVideoTab ? EnumSet.of(CtrlFlag.onVideoTab) : null;
                            ArticleQueryObj v2_2 = new ArticleQueryObj(refreshFrom, v4_2, v5, cateBehotTime,
                                    v8, false, v11, v12, v13, feedDataProvider.mCategoryInfo.mReferType,
                                    ((Long) feedDataProvider.c.get()).longValue());
                            v2_2.r = feedDataProvider.k;
                            v2_2.isRefreshing = false;
                            if (feedDataProvider.mCategoryInfo.mForumMovieId > 0) {
                                v2_2.movieId = feedDataProvider.mCategoryInfo.mForumMovieId;
                            }

                            if (feedDataProvider.mCategoryInfo.mIsFromConcernDetailVideo) {
                                int v20 = feedDataProvider.mCellRefList.size();
                                if (feedDataProvider.m > 0) {
                                    v20 = feedDataProvider.m;
                                }

                                int v13_1 = feedDataProvider.j;
                                String v14 = feedDataProvider.mCategoryInfo.mCategoryName;
                                long v16 = 0;
                                String v23 = feedDataProvider.mCategoryInfo.mExtra;
                                EnumSet v24 = feedDataProvider.mCategoryInfo.mOnVideoTab ? EnumSet.of(CtrlFlag.onVideoTab) : null;
                                v12_1 = new ArticleQueryObj(v13_1, v14, v5, v16, v8, v20, false, v11, v23, v24, feedDataProvider.mCategoryInfo.mReferType, ((Long) feedDataProvider.c.get()).longValue(), feedDataProvider.mCategoryInfo.mConcernDetailVideoQueryDict);
                            } else {
                                v12_1 = v2_2;
                            }

                            v2_2 = feedDataProvider.mCategoryInfo.mWendaReferType != -1
                                    ? new ArticleQueryObj(feedDataProvider.j, feedDataProvider.mCategoryInfo.mCategoryName,
                                    v5, 0, v8, false, v11, feedDataProvider.mCategoryInfo.mExtra,
                                    feedDataProvider.mCategoryInfo.mWendaReferType, ((Long) feedDataProvider.c.get()).longValue(),
                                    feedDataProvider.mCategoryInfo.mApiParam, 0)
                                    : v12_1;
                            v2_2.O = v30.c;
                            ArticleQueryThread articleQueryThread = new ArticleQueryThread(BaseApplication.getApplication(),
                                    feedDataProvider.o, v2_2);
                            articleQueryThread.start();
                            feedDataProvider.cancelPreviousQueryThread();
                            feedDataProvider.mRefArticleQueryThread = new WeakReference(articleQueryThread);
                            if (!"__all__".equals(feedDataProvider.mCategoryInfo.mCategoryName)) {
                                return;
                            }

                            AppData.getInstance().q();
                        }
                    }
                }
            }
        } else {
            this.showNotify(com.ss.android.article.browser.R.string.ss_hint_loading);
        }
    }

    private void refreshByCategoryTip() {
        this.mIsPullingToRefresh = true;
        this.mRefreshFrom = 9;
        this.mPendingPullRefresh = false;
        this.queryData();
    }

    public void refreshListHook() {
    }

    private void requestLocationPermission() {
        if ("news_local".equals(this.mCategoryName)) {
            if (Build.VERSION.SDK_INT >= 23) {
                SharedPreferences sharedPreferences = this.mContext.getSharedPreferences("main_app_settings", 0);
                if (sharedPreferences.getLong("last_location_permission_request_time", 0L) == 0L) {
                    Bundle bundle = new Bundle();
                    bundle.putString("location_permission", "location");
                    android.support.design.a.onEvent("show_permission_dialog", bundle);
                    PermissionsManager.getInstance().requestPermissions(this, new String[]{"android.permission.ACCESS_COARSE_LOCATION"}, new PermissionsResultAction() {

                        public final void onGranted() {
                            LocationHelper.getInstance(AbsApplication.getApplication()).a();
                            ArticleRecentFragment.onLocationPermissionEvent();
                        }

                        public final void onDenied(String arg1) {
                            ArticleRecentFragment.onLocationPermissionEvent();
                        }
                    });
                    SharedPreferences.Editor editor = sharedPreferences.edit();
                    editor.putLong("last_location_permission_request_time", System.currentTimeMillis());
                    editor.apply();
                    return;
                }
            }
            if (!PermissionsManager.getInstance().a(this.mContext, "android.permission.ACCESS_COARSE_LOCATION")) {
                return;
            }

            LocationHelper.getInstance(this.getActivity()).a();
        }
    }

    public void saveList() {
        if (this.isViewValid()) {
            this.getListData().a = this.getData();
            if (!this.getData().isEmpty()) {
                this.getListData().b = this.mListView.getFirstVisiblePosition() - this.mListView.getHeaderViewsCount();
                this.mAppData.a(this.getListData(), 1, this.mCategoryName);
            }
        }
    }

    public void setBackRefreshSwitch(boolean arg1) {
        this.mIsBackRefresh = arg1;
    }

    public void setBridgeApi(com.b.a.a.a arg1) {
        this.bridgeApi = arg1;
    }

    private void setCategoryCity(String categoryCity) {
        this.mCategoryCity = categoryCity;
        if (this.mFeedDataProvider != null) {
            this.mFeedDataProvider.mCategoryInfo.mCategoryCity = categoryCity;
        }

        if (this.mAdapter != null && ("news_local".equals(this.mCategoryName))) {
            FeedAdapter feedAdapter = this.mAdapter;
            String city = this.mCategoryCity;
            if (!android.support.design.a.isTextEquals(feedAdapter.mCategoryCity, city)) {
                feedAdapter.mCategoryCity = city;
                if (("news_local".equals(feedAdapter.mCategoryId)) && feedAdapter.c != null) {
                    feedAdapter.g();
                    city = (feedAdapter.c instanceof ImpressionRecorder) ? ((ImpressionRecorder) feedAdapter.c).b : ((String) null);
                    if (!android.support.design.a.isTextEmpty(city)) {
                        ImpressionHelper.getInstance().a(feedAdapter.c, city);
                    }
                    feedAdapter.c = null;
                }
            }
        }
    }

    private static void setContentLayoutMargin(int arg1, View arg2) {
        if (arg2 != null && ((arg2.getLayoutParams() instanceof ViewGroup.MarginLayoutParams))) {
            ViewGroup.LayoutParams v0 = arg2.getLayoutParams();
            ((ViewGroup.MarginLayoutParams) v0).topMargin = arg1;
            arg2.setLayoutParams(v0);
        }
    }

    public void setHasTips(boolean hasTips) {
        FragmentActivity fragmentActivity = this.getActivity();
        if (!(fragmentActivity instanceof IFeedManager)) {
            fragmentActivity = null;
        }

        if (fragmentActivity != null && (((IFeedManager) fragmentActivity).showTipsFor(this.mCategoryName))) {
            this.mHasTips = hasTips;
        }
    }

    void showPushPermissionDlg(final Context context, final int arg4, final View.OnClickListener arg5) {
        this.mHandler.post(new Runnable() {
            public final void run() {
                final PushPermissionDlg dialog = new PushPermissionDlg(context, "push_guide_feed");
                dialog.g = dialog.mContext.getResources().getDrawable(arg4);
                dialog.mTopImage.setBackgroundDrawable(dialog.g);
                dialog.mContentTitle.setText(com.ss.android.article.browser.R.string.sz);
                dialog.mContentText.setText(com.ss.android.article.browser.R.string.sy);
                String v1 = ArticleRecentFragment.this.mAppData.pushInterestText;
                if (!android.support.design.a.isTextEmpty(v1)) {
                    dialog.mContentText.setText(v1);
                }
                final View.OnClickListener v1_1 = arg5;
                dialog.mDialogConfirm.setText(com.ss.android.article.browser.R.string.rg);
                dialog.mDialogConfirm.setOnClickListener(new View.OnClickListener() {

                    public final void onClick(View arg5) {
                        MobClickCombiner.onEvent(dialog.mContext, "pop", dialog.f + "_open");
                        v1_1.onClick(arg5);
                        dialog.a();
                    }
                });
                if (context != null && (ArticleRecentFragment.this.isViewValid())) {
                    dialog.show();
                }
            }
        });
    }

    protected boolean supportLazyLoad() {
        return ArticleRecentFragment.mLazyLoad;
    }

    public int supportRefreshButton() {
        return 1;
    }

    private void tryCancelPrevQuery() {
        ArticleQueryThread queryThread = this.mQueryRef != null ? this.mQueryRef.get() : null;
        if (queryThread != null) {
            queryThread.cancel();
        }
        this.mQueryRef = null;
    }

    protected void updateLoadingStatus() {
        FragmentActivity v0 = this.getActivity();
        if ((v0 instanceof IFeedManager)) {
            ((IFeedManager) v0).onLoadingStatusChanged(((IRecentFragment) this));
        }

        if (this.isPrimaryPage()) {
            if ((this.isLoading()) && (this.getData().isEmpty())) {
                this.showLoadingAnim();
                return;
            }

            this.stopLoadingAnim();
        }
    }

    public void updateSubEntrance() {
        ObservableArrayList v0_1;
        int v4 = View.GONE;
        if ((android.support.design.a.h()) || (this.mAppData.getAppSettings().isShowSubChannel())) {
            int v2 = this.getResources().getDimensionPixelSize(R.dimen.hy);
            if (this.mFeedDataProvider == null) {
                v0_1 = null;
            } else {
                v0_1 = this.mFeedDataProvider.f;
            }

            this.mSearchLayout.setData((v0_1));
            if (v0_1 == null || ((List) v0_1).size() == 0) {
                this.mSearchLayout.setVisibility(v4);
                this.mDevider.setVisibility(v4);
                ArticleRecentFragment.setContentLayoutMargin(0, this.mPullRefreshList);
                ArticleRecentFragment.setContentLayoutMargin(0, this.mNotifyView);
            } else {
                this.onSubChannelShowEvent(v0_1);
                this.mSearchLayout.setVisibility(View.VISIBLE);
                this.mDevider.setVisibility(View.VISIBLE);
                ArticleRecentFragment.setContentLayoutMargin(v2, this.mPullRefreshList);
                ArticleRecentFragment.setContentLayoutMargin(v2, this.mNotifyView);
            }

            if (this.getActivity() == null) {
                return;
            }

            if (this.bridgeApi == null) {
                return;
            }

            boolean v0_2 = !android.support.design.a.h() || v0_1 == null || ((List) v0_1).size() <= 0 ? false : true;
            this.bridgeApi.a(v0_2);
        }
    }
}

